OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [doc/] [font.n] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: font.n,v 1.1.1.1 2002-01-16 10:25:49 markom Exp $
8
'\"
9
.so man.macros
10
.TH font n 8.0 Tk "Tk Built-In Commands"
11
.BS
12
'\" Note:  do not modify the .SH NAME line immediately below!
13
.SH NAME
14
font \- Create and inspect fonts.
15
.SH SYNOPSIS
16
\fBfont\fI option \fR?\fIarg arg ...\fR?
17
.BE
18
.SH DESCRIPTION
19
.PP
20
The \fBfont\fR command provides several facilities for dealing with
21
fonts, such as defining named fonts and inspecting the actual attributes of
22
a font.  The command has several different forms, determined by the
23
first argument.  The following forms are currently supported:
24
.TP
25
\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR?
26
.
27
Returns information about the the actual attributes that are obtained when
28
\fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained
29
may differ from the attributes requested due to platform-dependant
30
limitations, such as the availability of font families and pointsizes.
31
\fIfont\fR is a font description; see FONT DESCRIPTIONS below.  If the
32
\fIwindow\fR argument is omitted, it defaults to the main window.  If
33
\fIoption\fR is specified, returns the value of that attribute; if it is
34
omitted, the return value is a list of all the attributes and their values.
35
See FONT OPTIONS below for a list of the possible attributes.
36
.TP
37
\fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
38
.
39
Query or modify the desired attributes for the named font called
40
\fIfontname\fR.  If no \fIoption\fR is specified, returns a list describing
41
all the options and their values for \fIfontname\fR.  If a single \fIoption\fR
42
is specified with no \fIvalue\fR, then returns the current value of that
43
attribute.  If one or more \fIoption\fR\-\fIvalue\fR pairs are specified,
44
then the command modifies the given named font to have the given values; in
45
this case, all widgets using that font will redisplay themselves using the
46
new attributes for the font.  See FONT OPTIONS below for a list of the
47
possible attributes.
48
.TP
49
\fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR?
50
.
51
Creates a new named font and returns its name.  \fIfontname\fR specifies the
52
name for the font; if it is omitted, then Tk generates a new name of the
53
form \fBfont\fIx\fR, where \fIx\fR is an integer.  There may be any number
54
of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for
55
the new named font.  See FONT OPTIONS below for a list of the possible
56
attributes.
57
.TP
58
\fBfont delete\fR \fIfontname\fR ?\fIfontname ...\fR?
59
.
60
Delete the specified named fonts.  If there are widgets using the named font,
61
the named font won't actually be deleted until all the instances are
62
released.  Those widgets will continue to display using the last known values
63
for the named font.  If a deleted named font is subsequently recreated with
64
another call to \fBfont create\fR, the widgets will use the new named font
65
and redisplay themselves using the new attributes of that font.
66
.TP
67
\fBfont families\fR ?\fB\-displayof \fIwindow\fR?
68
.
69
The return value is a list of the case-insensitive names of all font families
70
that exist on \fIwindow\fR's display.  If the \fIwindow\fR argument is
71
omitted, it defaults to the main window.
72
.TP
73
\fBfont measure \fIfont\fR ?\fB\-displayof \fIwindow\fR? \fItext\fR
74
.
75
Measures the amount of space the string \fItext\fR would use in the given
76
\fIfont\fR when displayed in \fIwindow\fR.  \fIfont\fR is a font description;
77
see FONT DESCRIPTIONS below.  If the \fIwindow\fR argument is omitted, it
78
defaults to the main window.  The return value is the total width in pixels
79
of \fItext\fR, not including the extra pixels used by highly exagerrated
80
characters such as cursive ``f''.  If the string contains newlines or tabs,
81
those characters are not expanded or treated specially when measuring the
82
string.
83
.TP
84
\fBfont metrics \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR?
85
.
86
Returns information about the metrics (the font-specific data), for
87
\fIfont\fR when it is used on \fIwindow\fR's display.  \fIfont\fR is a font
88
description; see FONT DESCRIPTIONS below.  If the \fIwindow\fR argument is
89
omitted, it defaults to the main window.  If \fIoption\fR is specified,
90
returns the value of that metric; if it is omitted, the return value is a
91
list of all the metrics and their values.  See FONT METRICS below for a list
92
of the possible metrics.
93
.TP
94
\fBfont names\fR
95
The return value is a list of all the named fonts that are currently defined.
96
.SH "FONT DESCRIPTION"
97
.PP
98
The following formats are accepted as a font description anywhere
99
\fIfont\fR is specified as an argument above; these same forms are also
100
permitted when specifying the \fB\-font\fR option for widgets.
101
.TP
102
[1] \fIfontname\fR
103
.
104
The name of a named font, created using the \fBfont create\fR command.  When
105
a widget uses a named font, it is guaranteed that this will never cause an
106
error, as long as the named font exists, no matter what potentially invalid
107
or meaningless set of attributes the named font has.  If the named font
108
cannot be displayed with exactly the specified attributes, some other close
109
font will be substituted automatically.
110
.TP
111
[2] \fIsystemfont\fR
112
.
113
The platform-specific name of a font, interpreted by the graphics server.
114
This also includes, under X, an XLFD (see [4]) for which a single ``\fB*\fR''
115
character was used to elide more than one field in the middle of the
116
name.  See PLATFORM-SPECIFIC issues for a list of the system fonts.
117
.VS 8.0 br
118
.TP
119
[3] \fIfamily \fR?\fIsize\fR? ?\fIstyle\fR? ?\fIstyle ...\fR?
120
.
121
A properly formed list whose first element is the desired font
122
\fIfamily\fR and whose optional second element is the desired \fIsize\fR.
123
The interpretation of the \fIsize\fR attribute follows the same rules
124
described for \fB\-size\fR in FONT OPTIONS below.  Any additional optional
125
arguments following the \fIsize\fR are font \fIstyle\fRs.  Possible values
126
for the \fIstyle\fR arguments are as follows:
127
.RS
128
.DS
129
.ta 3c 6c 9c
130
\fBnormal       bold    roman   italic
131
underline       overstrike\fR
132
.DE
133
.RE
134
.TP
135
[4] X-font names (XLFD)
136
.
137
A Unix-centric font name of the form
138
\fI-foundry-family-weight-slant-setwidth-addstyle-pixel-point-resx-resy-spacing-width-charset-encoding\fR.
139
The ``\fB*\fR'' character may be used to skip individual fields that the
140
user does not care about.  There must be exactly one ``\fB*\fR'' for each
141
field skipped, except that a ``\fB*\fR'' at the end of the XLFD skips any
142
remaining fields; the shortest valid XLFD is simply ``\fB*\fR'', signifying
143
all fields as defaults.  Any fields that were skipped are given default
144
values.  For compatibility, an XLFD always chooses a font of the specified
145
pixel size (not point size); although this interpretation is not strictly
146
correct, all existing applications using XLFDs assumed that one ``point''
147
was in fact one pixel and would display incorrectly (generally larger) if
148
the correct size font were actually used.
149
.VE
150
.TP
151
[5] \fIoption value \fR?\fIoption value ...\fR?
152
.
153
A properly formed list of \fIoption\fR\-\fIvalue\fR pairs that specify
154
the desired attributes of the font, in the same format used when defining
155
a named font; see FONT OPTIONS below.
156
.LP
157
When font description \fIfont\fR is used, the system attempts to parse the
158
description according to each of the above five rules, in the order specified.
159
Cases [1] and [2] must match the name of an existing named font or of a
160
system font.  Cases [3], [4], and [5] are accepted on all
161
platforms and the closest available font will be used.  In some situations
162
it may not be possible to find any close font (e.g., the font family was
163
a garbage value); in that case, some system-dependant default font is
164
chosen.  If the font description does not match any of the above patterns,
165
an error is generated.
166
.SH "FONT METRICS"
167
.
168
The following options are used by the \fBfont metrics\fR command to query
169
font-specific data determined when the font was created.  These properties are
170
for the whole font itself and not for individual characters drawn in that
171
font.  In the following definitions, the ``baseline'' of a font is the
172
horizontal line where the bottom of most letters line up; certain letters,
173
such as lower-case ``g'' stick below the baseline.
174
.TP
175
\fB\-ascent        \0\fR
176
.
177
The amount in pixels that the tallest letter sticks up above the baseline of
178
the font, plus any extra blank space added by the designer of the font.
179
.TP
180
\fB\-descent       \0\fR
181
.
182
The largest amount in pixels that any letter sticks down below the baseline
183
of the font, plus any extra blank space added by the designer of the font.
184
.TP
185
\fB\-linespace\fR
186
.
187
Returns how far apart vertically in pixels two lines of text using the same
188
font should be placed so that none of the characters in one line overlap any
189
of the characters in the other line.  This is generally the sum of the ascent
190
above the baseline line plus the descent below the baseline.
191
.TP
192
\fB\-fixed          \0\fR
193
.
194
Returns a boolean flag that is ``\fB1\fR'' if this is a fixed-width font,
195
where each normal character is the the same width as all the other
196
characters, or is ``\fB0\fR'' if this is a proportionally-spaced font, where
197
individual characters have different widths.  The widths of control
198
characters, tab characters, and other non-printing characters are not
199
included when calculating this value.
200
.SH "FONT OPTIONS"
201
The following options are supported on all platforms, and are used when
202
constructing a named font or when specifying a font using style [5] as
203
above:
204
.TP
205
\fB\-family \fIname\fR
206
.
207
The case-insensitive font family name.  Tk guarantees to support the font
208
families named \fBCourier\fR (a monospaced ``typewriter'' font), \fBTimes\fR
209
(a serifed ``newspaper'' font), and \fBHelvetica\fR (a sans-serif
210
``European'' font).  The most closely matching native font family will
211
automatically be substituted when one of the above font families is used.
212
The \fIname\fR may also be the name of a native, platform-specific font
213
family; in that case it will work as desired on one platform but may not
214
display correctly on other platforms.  If the family is unspecified or
215
unrecognized, a platform-specific default font will be chosen.
216
.VS
217
.TP
218
\fB\-size \fIsize\fR
219
.
220
The desired size of the font.  If the \fIsize\fR argument is a positive
221
number, it is interpreted as a size in points.  If \fIsize\fR is a negative
222
number, its absolute value is interpreted as a size in pixels.  If a
223
font cannot be displayed at the specified size, a nearby size will be
224
chosen.  If \fIsize\fR is unspecified or zero, a platform-dependent default
225
size will be chosen.
226
.RS
227
.PP
228
Sizes should normally be specified in points so the application will remain
229
the same ruler size on the screen, even when changing screen resolutions or
230
moving scripts across platforms.  However, specifying pixels is useful in
231
certain circumstances such as when a piece of text must line up with respect
232
to a fixed-size bitmap.  The mapping between points and pixels is set when
233
the application starts, based on properties of the installed monitor, but it
234
can be overridden by calling the \fBtk scaling\fR command.
235
.RE
236
.VE
237
.TP
238
\fB\-weight \fIweight\fR
239
.
240
The nominal thickness of the characters in the font.  The value
241
\fBnormal\fR specifies a normal weight font, while \fBbold\fR specifies a
242
bold font.  The closest available weight to the one specified will
243
be chosen.  The default weight is \fBnormal\fR.
244
.TP
245
\fB\-slant \fIslant\fR
246
The amount the characters in the font are slanted away from the
247
vertical.  Valid values for slant are \fBroman\fR and \fBitalic\fR.
248
A roman font is the normal, upright appearance of a font, while
249
an italic font is one that is tilted some number of degrees from upright.
250
The closest available slant to the one specified will be chosen.
251
The default slant is \fBroman\fR.
252
.TP
253
\fB\-underline \fIboolean\fR
254
The value is a boolean flag that specifies whether characters in this
255
font should be underlined.  The default value for underline is \fBfalse\fR.
256
.TP
257
\fB\-overstrike \fIboolean\fR
258
The value is a boolean flag that specifies whether a horizontal line should
259
be drawn through the middle of characters in this font.  The default value
260
for overstrike is \fBfalse\fR.
261
 
262
.SH "PLATFORM-SPECIFIC ISSUES"
263
.LP
264
The following named system fonts are supported:
265
.RS
266
.TP
267
X Windows:
268
All valid X font names, including those listed by xlsfonts(1), are available.
269
.TP
270
MS Windows:
271
.DS
272
\fBsystem       ansi    device
273
systemfixed     ansifixed       oemfixed\fR
274
.DE
275
.TP
276
Macintosh:
277
.DS
278
\fBsystem       application\fR
279
.DE
280
.RE
281
.SH "SEE ALSO"
282
options
283
 
284
.SH KEYWORDS
285
font

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.