blob: f137740a88197bd0d9e61721f3f27768b7d0962a [file] [log] [blame]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001\section{Built-in Module \sectcode{fm}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-fm}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003\bimodindex{fm}
4
Fred Drakeaf8a0151998-01-14 14:51:31 +00005This module provides access to the IRIS \emph{Font Manager} library.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00006It is available only on Silicon Graphics machines.
Fred Drakec9808b31998-03-15 02:04:59 +00007See also: \emph{4Sight User's Guide}, Section 1, Chapter 5: ``Using
8the IRIS Font Manager.''
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00009
10This is not yet a full interface to the IRIS Font Manager.
11Among the unsupported features are: matrix operations; cache
12operations; character operations (use string operations instead); some
13details of font info; individual glyph metrics; and printer matching.
14
15It supports the following operations:
16
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000017\begin{funcdesc}{init}{}
18Initialization function.
Fred Drakec9808b31998-03-15 02:04:59 +000019Calls \cfunction{fminit()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000020It is normally not necessary to call this function, since it is called
Fred Drakec9808b31998-03-15 02:04:59 +000021automatically the first time the \module{fm} module is imported.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022\end{funcdesc}
23
24\begin{funcdesc}{findfont}{fontname}
25Return a font handle object.
26Calls \code{fmfindfont(\var{fontname})}.
27\end{funcdesc}
28
29\begin{funcdesc}{enumerate}{}
30Returns a list of available font names.
Fred Drakec9808b31998-03-15 02:04:59 +000031This is an interface to \cfunction{fmenumerate()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000032\end{funcdesc}
33
34\begin{funcdesc}{prstr}{string}
Fred Drakec9808b31998-03-15 02:04:59 +000035Render a string using the current font (see the \function{setfont()} font
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000036handle method below).
37Calls \code{fmprstr(\var{string})}.
38\end{funcdesc}
39
40\begin{funcdesc}{setpath}{string}
41Sets the font search path.
Fred Drakec9808b31998-03-15 02:04:59 +000042Calls \code{fmsetpath(\var{string})}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000043(XXX Does not work!?!)
44\end{funcdesc}
45
46\begin{funcdesc}{fontpath}{}
47Returns the current font search path.
48\end{funcdesc}
49
50Font handle objects support the following operations:
51
Fred Drake19479911998-02-13 06:58:54 +000052\setindexsubitem{(font handle method)}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000053\begin{funcdesc}{scalefont}{factor}
54Returns a handle for a scaled version of this font.
55Calls \code{fmscalefont(\var{fh}, \var{factor})}.
56\end{funcdesc}
57
58\begin{funcdesc}{setfont}{}
59Makes this font the current font.
60Note: the effect is undone silently when the font handle object is
61deleted.
62Calls \code{fmsetfont(\var{fh})}.
63\end{funcdesc}
64
65\begin{funcdesc}{getfontname}{}
66Returns this font's name.
67Calls \code{fmgetfontname(\var{fh})}.
68\end{funcdesc}
69
70\begin{funcdesc}{getcomment}{}
71Returns the comment string associated with this font.
72Raises an exception if there is none.
73Calls \code{fmgetcomment(\var{fh})}.
74\end{funcdesc}
75
76\begin{funcdesc}{getfontinfo}{}
77Returns a tuple giving some pertinent data about this font.
78This is an interface to \code{fmgetfontinfo()}.
79The returned tuple contains the following numbers:
Fred Drakec9808b31998-03-15 02:04:59 +000080\code{(}\var{printermatched}, \var{fixed_width}, \var{xorig},
81\var{yorig}, \var{xsize}, \var{ysize}, \var{height},
82\var{nglyphs}\code{)}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000083\end{funcdesc}
84
85\begin{funcdesc}{getstrwidth}{string}
Fred Drakec9808b31998-03-15 02:04:59 +000086Returns the width, in pixels, of \var{string} when drawn in this font.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000087Calls \code{fmgetstrwidth(\var{fh}, \var{string})}.
88\end{funcdesc}