Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / man / mann / font.n
CommitLineData
86530b38
AT
1'\"
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.3.8.1 2004/10/28 10:19:29 dkf Exp $
8'\"
9'\" The definitions below are for supplemental macros used in Tcl/Tk
10'\" manual entries.
11'\"
12'\" .AP type name in/out ?indent?
13'\" Start paragraph describing an argument to a library procedure.
14'\" type is type of argument (int, etc.), in/out is either "in", "out",
15'\" or "in/out" to describe whether procedure reads or modifies arg,
16'\" and indent is equivalent to second arg of .IP (shouldn't ever be
17'\" needed; use .AS below instead)
18'\"
19'\" .AS ?type? ?name?
20'\" Give maximum sizes of arguments for setting tab stops. Type and
21'\" name are examples of largest possible arguments that will be passed
22'\" to .AP later. If args are omitted, default tab stops are used.
23'\"
24'\" .BS
25'\" Start box enclosure. From here until next .BE, everything will be
26'\" enclosed in one large box.
27'\"
28'\" .BE
29'\" End of box enclosure.
30'\"
31'\" .CS
32'\" Begin code excerpt.
33'\"
34'\" .CE
35'\" End code excerpt.
36'\"
37'\" .VS ?version? ?br?
38'\" Begin vertical sidebar, for use in marking newly-changed parts
39'\" of man pages. The first argument is ignored and used for recording
40'\" the version when the .VS was added, so that the sidebars can be
41'\" found and removed when they reach a certain age. If another argument
42'\" is present, then a line break is forced before starting the sidebar.
43'\"
44'\" .VE
45'\" End of vertical sidebar.
46'\"
47'\" .DS
48'\" Begin an indented unfilled display.
49'\"
50'\" .DE
51'\" End of indented unfilled display.
52'\"
53'\" .SO
54'\" Start of list of standard options for a Tk widget. The
55'\" options follow on successive lines, in four columns separated
56'\" by tabs.
57'\"
58'\" .SE
59'\" End of list of standard options for a Tk widget.
60'\"
61'\" .OP cmdName dbName dbClass
62'\" Start of description of a specific option. cmdName gives the
63'\" option's name as specified in the class command, dbName gives
64'\" the option's name in the option database, and dbClass gives
65'\" the option's class in the option database.
66'\"
67'\" .UL arg1 arg2
68'\" Print arg1 underlined, then print arg2 normally.
69'\"
70'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
71'\"
72'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
73.if t .wh -1.3i ^B
74.nr ^l \n(.l
75.ad b
76'\" # Start an argument description
77.de AP
78.ie !"\\$4"" .TP \\$4
79.el \{\
80. ie !"\\$2"" .TP \\n()Cu
81. el .TP 15
82.\}
83.ta \\n()Au \\n()Bu
84.ie !"\\$3"" \{\
85\&\\$1 \\fI\\$2\\fP (\\$3)
86.\".b
87.\}
88.el \{\
89.br
90.ie !"\\$2"" \{\
91\&\\$1 \\fI\\$2\\fP
92.\}
93.el \{\
94\&\\fI\\$1\\fP
95.\}
96.\}
97..
98'\" # define tabbing values for .AP
99.de AS
100.nr )A 10n
101.if !"\\$1"" .nr )A \\w'\\$1'u+3n
102.nr )B \\n()Au+15n
103.\"
104.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
105.nr )C \\n()Bu+\\w'(in/out)'u+2n
106..
107.AS Tcl_Interp Tcl_CreateInterp in/out
108'\" # BS - start boxed text
109'\" # ^y = starting y location
110'\" # ^b = 1
111.de BS
112.br
113.mk ^y
114.nr ^b 1u
115.if n .nf
116.if n .ti 0
117.if n \l'\\n(.lu\(ul'
118.if n .fi
119..
120'\" # BE - end boxed text (draw box now)
121.de BE
122.nf
123.ti 0
124.mk ^t
125.ie n \l'\\n(^lu\(ul'
126.el \{\
127.\" Draw four-sided box normally, but don't draw top of
128.\" box if the box started on an earlier page.
129.ie !\\n(^b-1 \{\
130\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
131.\}
132.el \}\
133\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
134.\}
135.\}
136.fi
137.br
138.nr ^b 0
139..
140'\" # VS - start vertical sidebar
141'\" # ^Y = starting y location
142'\" # ^v = 1 (for troff; for nroff this doesn't matter)
143.de VS
144.if !"\\$2"" .br
145.mk ^Y
146.ie n 'mc \s12\(br\s0
147.el .nr ^v 1u
148..
149'\" # VE - end of vertical sidebar
150.de VE
151.ie n 'mc
152.el \{\
153.ev 2
154.nf
155.ti 0
156.mk ^t
157\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
158.sp -1
159.fi
160.ev
161.\}
162.nr ^v 0
163..
164'\" # Special macro to handle page bottom: finish off current
165'\" # box/sidebar if in box/sidebar mode, then invoked standard
166'\" # page bottom macro.
167.de ^B
168.ev 2
169'ti 0
170'nf
171.mk ^t
172.if \\n(^b \{\
173.\" Draw three-sided box if this is the box's first page,
174.\" draw two sides but no top otherwise.
175.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
177.\}
178.if \\n(^v \{\
179.nr ^x \\n(^tu+1v-\\n(^Yu
180\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
181.\}
182.bp
183'fi
184.ev
185.if \\n(^b \{\
186.mk ^y
187.nr ^b 2
188.\}
189.if \\n(^v \{\
190.mk ^Y
191.\}
192..
193'\" # DS - begin display
194.de DS
195.RS
196.nf
197.sp
198..
199'\" # DE - end display
200.de DE
201.fi
202.RE
203.sp
204..
205'\" # SO - start of list of standard options
206.de SO
207.SH "STANDARD OPTIONS"
208.LP
209.nf
210.ta 5.5c 11c
211.ft B
212..
213'\" # SE - end of list of standard options
214.de SE
215.fi
216.ft R
217.LP
218See the \\fBoptions\\fR manual entry for details on the standard options.
219..
220'\" # OP - start of full description for a single option
221.de OP
222.LP
223.nf
224.ta 4c
225Command-Line Name: \\fB\\$1\\fR
226Database Name: \\fB\\$2\\fR
227Database Class: \\fB\\$3\\fR
228.fi
229.IP
230..
231'\" # CS - begin code excerpt
232.de CS
233.RS
234.nf
235.ta .25i .5i .75i 1i
236..
237'\" # CE - end code excerpt
238.de CE
239.fi
240.RE
241..
242.de UL
243\\$1\l'|0\(ul'\\$2
244..
245.TH font n 8.0 Tk "Tk Built-In Commands"
246.BS
247'\" Note: do not modify the .SH NAME line immediately below!
248.SH NAME
249font \- Create and inspect fonts.
250.SH SYNOPSIS
251\fBfont\fI option \fR?\fIarg arg ...\fR?
252.BE
253.SH DESCRIPTION
254.PP
255The \fBfont\fR command provides several facilities for dealing with
256fonts, such as defining named fonts and inspecting the actual attributes of
257a font. The command has several different forms, determined by the
258first argument. The following forms are currently supported:
259.TP
260\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR?
261.
262Returns information about the actual attributes that are obtained when
263\fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained
264may differ from the attributes requested due to platform-dependant
265limitations, such as the availability of font families and pointsizes.
266\fIfont\fR is a font description; see FONT DESCRIPTIONS below. If the
267\fIwindow\fR argument is omitted, it defaults to the main window. If
268\fIoption\fR is specified, returns the value of that attribute; if it is
269omitted, the return value is a list of all the attributes and their values.
270See FONT OPTIONS below for a list of the possible attributes.
271.TP
272\fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
273.
274Query or modify the desired attributes for the named font called
275\fIfontname\fR. If no \fIoption\fR is specified, returns a list describing
276all the options and their values for \fIfontname\fR. If a single \fIoption\fR
277is specified with no \fIvalue\fR, then returns the current value of that
278attribute. If one or more \fIoption\fR\-\fIvalue\fR pairs are specified,
279then the command modifies the given named font to have the given values; in
280this case, all widgets using that font will redisplay themselves using the
281new attributes for the font. See FONT OPTIONS below for a list of the
282possible attributes.
283.TP
284\fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR?
285.
286Creates a new named font and returns its name. \fIfontname\fR specifies the
287name for the font; if it is omitted, then Tk generates a new name of the
288form \fBfont\fIx\fR, where \fIx\fR is an integer. There may be any number
289of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for
290the new named font. See FONT OPTIONS below for a list of the possible
291attributes.
292.TP
293\fBfont delete\fR \fIfontname\fR ?\fIfontname ...\fR?
294.
295Delete the specified named fonts. If there are widgets using the named font,
296the named font won't actually be deleted until all the instances are
297released. Those widgets will continue to display using the last known values
298for the named font. If a deleted named font is subsequently recreated with
299another call to \fBfont create\fR, the widgets will use the new named font
300and redisplay themselves using the new attributes of that font.
301.TP
302\fBfont families\fR ?\fB\-displayof \fIwindow\fR?
303.
304The return value is a list of the case-insensitive names of all font families
305that exist on \fIwindow\fR's display. If the \fIwindow\fR argument is
306omitted, it defaults to the main window.
307.TP
308\fBfont measure \fIfont\fR ?\fB\-displayof \fIwindow\fR? \fItext\fR
309.
310Measures the amount of space the string \fItext\fR would use in the given
311\fIfont\fR when displayed in \fIwindow\fR. \fIfont\fR is a font description;
312see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is omitted, it
313defaults to the main window. The return value is the total width in pixels
314of \fItext\fR, not including the extra pixels used by highly exaggerated
315characters such as cursive ``f''. If the string contains newlines or tabs,
316those characters are not expanded or treated specially when measuring the
317string.
318.TP
319\fBfont metrics \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR?
320.
321Returns information about the metrics (the font-specific data), for
322\fIfont\fR when it is used on \fIwindow\fR's display. \fIfont\fR is a font
323description; see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is
324omitted, it defaults to the main window. If \fIoption\fR is specified,
325returns the value of that metric; if it is omitted, the return value is a
326list of all the metrics and their values. See FONT METRICS below for a list
327of the possible metrics.
328.TP
329\fBfont names\fR
330The return value is a list of all the named fonts that are currently defined.
331.SH "FONT DESCRIPTION"
332.PP
333The following formats are accepted as a font description anywhere
334\fIfont\fR is specified as an argument above; these same forms are also
335permitted when specifying the \fB\-font\fR option for widgets.
336.TP
337[1] \fIfontname\fR
338.
339The name of a named font, created using the \fBfont create\fR command. When
340a widget uses a named font, it is guaranteed that this will never cause an
341error, as long as the named font exists, no matter what potentially invalid
342or meaningless set of attributes the named font has. If the named font
343cannot be displayed with exactly the specified attributes, some other close
344font will be substituted automatically.
345.TP
346[2] \fIsystemfont\fR
347.
348The platform-specific name of a font, interpreted by the graphics server.
349This also includes, under X, an XLFD (see [4]) for which a single ``\fB*\fR''
350character was used to elide more than one field in the middle of the
351name. See PLATFORM-SPECIFIC issues for a list of the system fonts.
352.VS 8.0 br
353.TP
354[3] \fIfamily \fR?\fIsize\fR? ?\fIstyle\fR? ?\fIstyle ...\fR?
355.
356A properly formed list whose first element is the desired font
357\fIfamily\fR and whose optional second element is the desired \fIsize\fR.
358The interpretation of the \fIsize\fR attribute follows the same rules
359described for \fB\-size\fR in FONT OPTIONS below. Any additional optional
360arguments following the \fIsize\fR are font \fIstyle\fRs. Possible values
361for the \fIstyle\fR arguments are as follows:
362.RS
363.DS
364.ta 3c 6c 9c
365\fBnormal bold roman italic
366underline overstrike\fR
367.DE
368.RE
369.TP
370[4] X-font names (XLFD)
371.
372A Unix-centric font name of the form
373\fI-foundry-family-weight-slant-setwidth-addstyle-pixel-point-resx-resy-spacing-width-charset-encoding\fR.
374The ``\fB*\fR'' character may be used to skip individual fields that the
375user does not care about. There must be exactly one ``\fB*\fR'' for each
376field skipped, except that a ``\fB*\fR'' at the end of the XLFD skips any
377remaining fields; the shortest valid XLFD is simply ``\fB*\fR'', signifying
378all fields as defaults. Any fields that were skipped are given default
379values. For compatibility, an XLFD always chooses a font of the specified
380pixel size (not point size); although this interpretation is not strictly
381correct, all existing applications using XLFDs assumed that one ``point''
382was in fact one pixel and would display incorrectly (generally larger) if
383the correct size font were actually used.
384.VE
385.TP
386[5] \fIoption value \fR?\fIoption value ...\fR?
387.
388A properly formed list of \fIoption\fR\-\fIvalue\fR pairs that specify
389the desired attributes of the font, in the same format used when defining
390a named font; see FONT OPTIONS below.
391.LP
392When font description \fIfont\fR is used, the system attempts to parse the
393description according to each of the above five rules, in the order specified.
394Cases [1] and [2] must match the name of an existing named font or of a
395system font. Cases [3], [4], and [5] are accepted on all
396platforms and the closest available font will be used. In some situations
397it may not be possible to find any close font (e.g., the font family was
398a garbage value); in that case, some system-dependant default font is
399chosen. If the font description does not match any of the above patterns,
400an error is generated.
401.SH "FONT METRICS"
402.
403The following options are used by the \fBfont metrics\fR command to query
404font-specific data determined when the font was created. These properties are
405for the whole font itself and not for individual characters drawn in that
406font. In the following definitions, the ``baseline'' of a font is the
407horizontal line where the bottom of most letters line up; certain letters,
408such as lower-case ``g'' stick below the baseline.
409.TP
410\fB\-ascent \0\fR
411.
412The amount in pixels that the tallest letter sticks up above the baseline of
413the font, plus any extra blank space added by the designer of the font.
414.TP
415\fB\-descent \0\fR
416.
417The largest amount in pixels that any letter sticks down below the baseline
418of the font, plus any extra blank space added by the designer of the font.
419.TP
420\fB\-linespace\fR
421.
422Returns how far apart vertically in pixels two lines of text using the same
423font should be placed so that none of the characters in one line overlap any
424of the characters in the other line. This is generally the sum of the ascent
425above the baseline line plus the descent below the baseline.
426.TP
427\fB\-fixed \0\fR
428.
429Returns a boolean flag that is ``\fB1\fR'' if this is a fixed-width font,
430where each normal character is the same width as all the other
431characters, or is ``\fB0\fR'' if this is a proportionally-spaced font, where
432individual characters have different widths. The widths of control
433characters, tab characters, and other non-printing characters are not
434included when calculating this value.
435.SH "FONT OPTIONS"
436The following options are supported on all platforms, and are used when
437constructing a named font or when specifying a font using style [5] as
438above:
439.TP
440\fB\-family \fIname\fR
441.
442The case-insensitive font family name. Tk guarantees to support the font
443families named \fBCourier\fR (a monospaced ``typewriter'' font), \fBTimes\fR
444(a serifed ``newspaper'' font), and \fBHelvetica\fR (a sans-serif
445``European'' font). The most closely matching native font family will
446automatically be substituted when one of the above font families is used.
447The \fIname\fR may also be the name of a native, platform-specific font
448family; in that case it will work as desired on one platform but may not
449display correctly on other platforms. If the family is unspecified or
450unrecognized, a platform-specific default font will be chosen.
451.VS
452.TP
453\fB\-size \fIsize\fR
454.
455The desired size of the font. If the \fIsize\fR argument is a positive
456number, it is interpreted as a size in points. If \fIsize\fR is a negative
457number, its absolute value is interpreted as a size in pixels. If a
458font cannot be displayed at the specified size, a nearby size will be
459chosen. If \fIsize\fR is unspecified or zero, a platform-dependent default
460size will be chosen.
461.RS
462.PP
463Sizes should normally be specified in points so the application will remain
464the same ruler size on the screen, even when changing screen resolutions or
465moving scripts across platforms. However, specifying pixels is useful in
466certain circumstances such as when a piece of text must line up with respect
467to a fixed-size bitmap. The mapping between points and pixels is set when
468the application starts, based on properties of the installed monitor, but it
469can be overridden by calling the \fBtk scaling\fR command.
470.RE
471.VE
472.TP
473\fB\-weight \fIweight\fR
474.
475The nominal thickness of the characters in the font. The value
476\fBnormal\fR specifies a normal weight font, while \fBbold\fR specifies a
477bold font. The closest available weight to the one specified will
478be chosen. The default weight is \fBnormal\fR.
479.TP
480\fB\-slant \fIslant\fR
481The amount the characters in the font are slanted away from the
482vertical. Valid values for slant are \fBroman\fR and \fBitalic\fR.
483A roman font is the normal, upright appearance of a font, while
484an italic font is one that is tilted some number of degrees from upright.
485The closest available slant to the one specified will be chosen.
486The default slant is \fBroman\fR.
487.TP
488\fB\-underline \fIboolean\fR
489The value is a boolean flag that specifies whether characters in this
490font should be underlined. The default value for underline is \fBfalse\fR.
491.TP
492\fB\-overstrike \fIboolean\fR
493The value is a boolean flag that specifies whether a horizontal line should
494be drawn through the middle of characters in this font. The default value
495for overstrike is \fBfalse\fR.
496.SH "PLATFORM-SPECIFIC ISSUES"
497.LP
498The following named system fonts are supported:
499.RS
500.TP
501X Windows:
502All valid X font names, including those listed by xlsfonts(1), are available.
503.TP
504MS Windows:
505.DS
506.ta 3c 6c
507\fBsystem ansi device
508systemfixed ansifixed oemfixed\fR
509.DE
510.TP
511Macintosh:
512.DS
513.ta 3c 6c
514\fBsystem application\fR
515.DE
516.RE
517.SH EXAMPLE
518Fill a text widget with lots of font demonstrators, one for every font
519family installed on your system:
520.CS
521pack [text .t -wrap none] -fill both -expand 1
522set count 0
523set tabwidth 0
524foreach family [lsort -dictionary [\fBfont families\fR]] {
525 .t tag configure f[incr count] -font [list $family 10]
526 .t insert end ${family}:\\t {} \\
527 "This is a simple sampler\\n" f$count
528 set w [\fBfont measure\fR [.t cget -font] ${family}:]
529 if {$w+5 > $tabwidth} {
530 set tabwidth [expr {$w+5}]
531 .t configure -tabs $tabwidth
532 }
533}
534.CE
535
536.SH "SEE ALSO"
537options(n)
538
539.SH KEYWORDS
540font