1Tk_FontId(3) Tk Library Procedures Tk_FontId(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_FontId, Tk_GetFontMetrics, Tk_PostscriptFontName - accessor func‐
9 tions for fonts
10
12 #include <tk.h>
13
14 Font
15 Tk_FontId(tkfont)
16
17 Tk_GetFontMetrics(tkfont, fmPtr)
18
19 int
20 Tk_PostscriptFontName(tkfont, dsPtr)
21
23 Tk_Font tkfont (in) Opaque font token being queried.
24 Must have been returned by a previ‐
25 ous call to Tk_GetFont.
26
27 Tk_FontMetrics *fmPtr (out) Pointer to structure in which the
28 font metrics for tkfont will be
29 stored. See DATA STRUCTURES below
30 for details.
31
32 Tcl_DString *dsPtr (out) Pointer to an initialized
33 Tcl_DString to which the name of
34 the Postscript font that corre‐
35 sponds to tkfont will be appended.
36_________________________________________________________________
37
39 Given a tkfont, Tk_FontId returns the token that should be selected
40 into an XGCValues structure in order to construct a graphics context
41 that can be used to draw text in the specified font.
42
43 Tk_GetFontMetrics computes the ascent, descent, and linespace of the
44 tkfont in pixels and stores those values in the structure pointer to by
45 fmPtr. These values can be used in computations such as to space mul‐
46 tiple lines of text, to align the baselines of text in different fonts,
47 and to vertically align text in a given region. See the documentation
48 for the font command for definitions of the terms ascent, descent, and
49 linespace, used in font metrics.
50
51 Tk_PostscriptFontName maps a tkfont to the corresponding Postscript
52 font name that should be used when printing. The return value is the
53 size in points of the tkfont and the Postscript font name is appended
54 to dsPtr. DsPtr must refer to an initialized Tcl_DString. Given a
55 “reasonable” Postscript printer, the following screen font families
56 should print correctly:
57
58 Avant Garde, Arial, Bookman, Courier, Courier New, Geneva, Hel‐
59 vetica, Monaco, New Century Schoolbook, New York, Palatino, Sym‐
60 bol, Times, Times New Roman, Zapf Chancery, and Zapf Dingbats.
61
62 Any other font families may not print correctly because the computed
63 Postscript font name may be incorrect or not exist on the printer.
64
66 The Tk_FontMetrics data structure is used by Tk_GetFontMetrics to
67 return information about a font and is defined as follows:
68 typedef struct Tk_FontMetrics {
69 int ascent;
70 int descent;
71 int linespace;
72 } Tk_FontMetrics;
73
74 The ascent field is the amount in pixels that the tallest letter sticks
75 up above the baseline, plus any extra blank space added by the designer
76 of the font.
77
78 The descent is the largest amount in pixels that any letter sticks
79 below the baseline, plus any extra blank space added by the designer of
80 the font.
81
82 The linespace is the sum of the ascent and descent. How far apart two
83 lines of text in the same font should be placed so that none of the
84 characters in one line overlap any of the characters in the other line.
85
87 font(n), MeasureChar(3)
88
90 font, measurement, Postscript
91
92
93
94Tk 8.0 Tk_FontId(3)