1Tk_FontId(3)                 Tk Library Procedures                Tk_FontId(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_FontId,  Tk_GetFontMetrics,  Tk_PostscriptFontName  - accessor func‐
9       tions for fonts
10

SYNOPSIS

12       #include <tk.h>
13
14       Font
15       Tk_FontId(tkfont)
16
17       void
18       Tk_GetFontMetrics(tkfont, fmPtr)
19
20       int
21       Tk_PostscriptFontName(tkfont, dsPtr)
22
23

ARGUMENTS

25       Tk_Font          tkfont   (in)      Opaque font  token  being  queried.
26                                           Must have been returned by a previ‐
27                                           ous call to Tk_GetFont.
28
29       Tk_FontMetrics   *fmPtr   (out)     Pointer to structure in  which  the
30                                           font  metrics  for  tkfont  will be
31                                           stored.
32
33       Tcl_DString      *dsPtr   (out)     Pointer    to    an     initialized
34                                           Tcl_DString  to  which  the name of
35                                           the  Postscript  font  that  corre‐
36                                           sponds to tkfont will be appended.
37_________________________________________________________________
38
39

DESCRIPTION

41       Given  a  tkfont,  Tk_FontId  returns the token that should be selected
42       into an XGCValues structure in order to construct  a  graphics  context
43       that can be used to draw text in the specified font.
44
45       Tk_GetFontMetrics  computes  the  ascent, descent, and linespace of the
46       tkfont in pixels and stores those values in the structure pointer to by
47       fmPtr.   These values can be used in computations such as to space mul‐
48       tiple lines of text, to align the baselines of text in different fonts,
49       and  to vertically align text in a given region.  See the documentation
50       for the font command for definitions of the terms ascent, descent,  and
51       linespace, used in font metrics.
52
53       Tk_PostscriptFontName maps a tkfont to the corresponding Postcript font
54       name that should be used when printing.  The return value is  the  size
55       in  points  of  the  tkfont and the Postscript font name is appended to
56       dsPtr.  DsPtr must refer to an initialized Tcl_DString.  Given a ``rea‐
57       sonable'' Postscript printer, the following screen font families should
58       print correctly:
59
60              Avant Garde, Arial, Bookman, Courier, Courier New, Geneva,  Hel‐
61              vetica, Monaco, New Century Schoolbook, New York, Palatino, Sym‐
62              bol, Times, Times New Roman, Zapf Chancery, and Zapf Dingbats.
63
64       Any other font families may not print correctly  because  the  computed
65       Postscript font name may be incorrect or not exist on the printer.
66

DATA STRUCTURES │

68       The  Tk_FontMetrics  data  structure  is  used  by Tk_GetFontMetrics to │
69       return information about a font and is defined as follows:              │
70              typedef struct Tk_FontMetrics {                                  │
71                  int ascent;                                                  │
72                  int descent;                                                 │
73                  int linespace;                                               │
74              } Tk_FontMetrics;                                                │
75       The linespace field is the amount in pixels  that  the  tallest  letter │
76       sticks  up  above the baseline, plus any extra blank space added by the │
77       designer of the font.                                                   │
78
79       The descent is the largest amount in  pixels  that  any  letter  sticks │
80       below the baseline, plus any extra blank space added by the designer of │
81       the font.                                                               │
82
83       The linespace is the sum of the ascent and descent.  How far apart  two │
84       lines  of  text  in  the same font should be placed so that none of the │
85       characters in one line overlap any of the characters in the other line.
86

KEYWORDS

88       font
89
90
91
92Tk                                    8.0                         Tk_FontId(3)
Impressum