summaryrefslogtreecommitdiffstats
path: root/doc/font.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/font.n')
-rw-r--r--doc/font.n102
1 files changed, 64 insertions, 38 deletions
diff --git a/doc/font.n b/doc/font.n
index a841f0c..633b710 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: font.n,v 1.17 2007/10/26 20:13:23 dgp Exp $
+'\" RCS: @(#) $Id: font.n,v 1.18 2007/10/29 16:04:13 dkf Exp $
'\"
.so man.macros
.TH font n 8.0 Tk "Tk Built-In Commands"
@@ -23,22 +23,22 @@ fonts, such as defining named fonts and inspecting the actual attributes of
a font. The command has several different forms, determined by the
first argument. The following forms are currently supported:
.TP
-\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? ?\fB--\fR? ?\fIchar\fR?
+\fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? ?\fB\-\|\-\fR? ?\fIchar\fR?
.
Returns information about the actual attributes that are obtained when
\fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained
may differ from the attributes requested due to platform-dependant
limitations, such as the availability of font families and pointsizes.
-\fIfont\fR is a font description; see FONT DESCRIPTIONS below. If the
+\fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the
\fIwindow\fR argument is omitted, it defaults to the main window. If
\fIoption\fR is specified, returns the value of that attribute; if it is
omitted, the return value is a list of all the attributes and their values.
-See FONT OPTIONS below for a list of the possible attributes. If the
+See \fBFONT OPTIONS\fR below for a list of the possible attributes. If the
\fIchar\fR argument is supplied, it must be a single character. The font
attributes returned will be those of the specific font used to render
that character, which will be different from the base font if the base
font does not contain the given character. If \fIchar\fR may be a hyphen, it
-should be preceded by \fB--\fR to distinguish it from a misspelled
+should be preceded by \fB\-\|\-\fR to distinguish it from a misspelled
\fIoption\fR.
.TP
\fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
@@ -50,7 +50,7 @@ is specified with no \fIvalue\fR, then returns the current value of that
attribute. If one or more \fIoption\fR\-\fIvalue\fR pairs are specified,
then the command modifies the given named font to have the given values; in
this case, all widgets using that font will redisplay themselves using the
-new attributes for the font. See FONT OPTIONS below for a list of the
+new attributes for the font. See \fBFONT OPTIONS\fR below for a list of the
possible attributes.
.TP
\fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR?
@@ -59,13 +59,13 @@ Creates a new named font and returns its name. \fIfontname\fR specifies the
name for the font; if it is omitted, then Tk generates a new name of the
form \fBfont\fIx\fR, where \fIx\fR is an integer. There may be any number
of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for
-the new named font. See FONT OPTIONS below for a list of the possible
+the new named font. See \fBFONT OPTIONS\fR below for a list of the possible
attributes.
.TP
\fBfont delete\fR \fIfontname\fR ?\fIfontname ...\fR?
.
Delete the specified named fonts. If there are widgets using the named font,
-the named font won't actually be deleted until all the instances are
+the named font will not actually be deleted until all the instances are
released. Those widgets will continue to display using the last known values
for the named font. If a deleted named font is subsequently recreated with
another call to \fBfont create\fR, the widgets will use the new named font
@@ -81,10 +81,13 @@ omitted, it defaults to the main window.
.
Measures the amount of space the string \fItext\fR would use in the given
\fIfont\fR when displayed in \fIwindow\fR. \fIfont\fR is a font description;
-see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is omitted, it
+see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is
+omitted, it
defaults to the main window. The return value is the total width in pixels
of \fItext\fR, not including the extra pixels used by highly exaggerated
-characters such as cursive ``f''. If the string contains newlines or tabs,
+characters such as cursive
+.QW f .
+If the string contains newlines or tabs,
those characters are not expanded or treated specially when measuring the
string.
.TP
@@ -92,11 +95,12 @@ string.
.
Returns information about the metrics (the font-specific data), for
\fIfont\fR when it is used on \fIwindow\fR's display. \fIfont\fR is a font
-description; see FONT DESCRIPTIONS below. If the \fIwindow\fR argument is
+description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR
+argument is
omitted, it defaults to the main window. If \fIoption\fR is specified,
returns the value of that metric; if it is omitted, the return value is a
-list of all the metrics and their values. See FONT METRICS below for a list
-of the possible metrics.
+list of all the metrics and their values. See \fBFONT METRICS\fR
+below for a list of the possible metrics.
.TP
\fBfont names\fR
The return value is a list of all the named fonts that are currently defined.
@@ -118,16 +122,18 @@ font will be substituted automatically.
[2] \fIsystemfont\fR
.
The platform-specific name of a font, interpreted by the graphics server.
-This also includes, under X, an XLFD (see [4]) for which a single ``\fB*\fR''
+This also includes, under X, an XLFD (see [4]) for which a single
+.QW \fB*\fR
character was used to elide more than one field in the middle of the
-name. See PLATFORM-SPECIFIC issues for a list of the system fonts.
+name. See \fBPLATFORM-SPECIFIC\fR issues for a list of the system fonts.
.TP
[3] \fIfamily \fR?\fIsize\fR? ?\fIstyle\fR? ?\fIstyle ...\fR?
.
A properly formed list whose first element is the desired font
\fIfamily\fR and whose optional second element is the desired \fIsize\fR.
The interpretation of the \fIsize\fR attribute follows the same rules
-described for \fB\-size\fR in FONT OPTIONS below. Any additional optional
+described for \fB\-size\fR in \fBFONT OPTIONS\fR below. Any
+additional optional
arguments following the \fIsize\fR are font \fIstyle\fRs. Possible values
for the \fIstyle\fR arguments are as follows:
.RS
@@ -141,15 +147,23 @@ underline overstrike\fR
[4] X-font names (XLFD)
.
A Unix-centric font name of the form
-\fI-foundry-family-weight-slant-setwidth-addstyle-pixel-point-resx-resy-spacing-width-charset-encoding\fR.
-The ``\fB*\fR'' character may be used to skip individual fields that the
-user does not care about. There must be exactly one ``\fB*\fR'' for each
-field skipped, except that a ``\fB*\fR'' at the end of the XLFD skips any
-remaining fields; the shortest valid XLFD is simply ``\fB*\fR'', signifying
-all fields as defaults. Any fields that were skipped are given default
+\fI\-foundry\-family\-weight\-slant\-setwidth\-addstyle\-pixel\-point\-resx\-resy\-spacing\-width\-charset\-encoding\fR.
+The
+.QW \fB*\fR
+character may be used to skip individual fields that the
+user does not care about. There must be exactly one
+.QW \fB*\fR
+for each field skipped, except that a
+.QW \fB*\fR
+at the end of the XLFD skips any
+remaining fields; the shortest valid XLFD is simply
+.QW \fB*\fR ,
+signifying all fields as defaults. Any fields that were skipped are
+given default
values. For compatibility, an XLFD always chooses a font of the specified
pixel size (not point size); although this interpretation is not strictly
-correct, all existing applications using XLFDs assumed that one ``point''
+correct, all existing applications using XLFDs assumed that one
+.QW point
was in fact one pixel and would display incorrectly (generally larger) if
the correct size font were actually used.
.TP
@@ -157,7 +171,7 @@ the correct size font were actually used.
.
A properly formed list of \fIoption\fR\-\fIvalue\fR pairs that specify
the desired attributes of the font, in the same format used when defining
-a named font; see FONT OPTIONS below.
+a named font; see \fBFONT OPTIONS\fR below.
.LP
When font description \fIfont\fR is used, the system attempts to parse the
description according to each of the above five rules, in the order specified.
@@ -173,9 +187,13 @@ an error is generated.
The following options are used by the \fBfont metrics\fR command to query
font-specific data determined when the font was created. These properties are
for the whole font itself and not for individual characters drawn in that
-font. In the following definitions, the ``baseline'' of a font is the
+font. In the following definitions, the
+.QW baseline
+of a font is the
horizontal line where the bottom of most letters line up; certain letters,
-such as lower-case ``g'' stick below the baseline.
+such as lower-case
+.QW g
+stick below the baseline.
.TP
\fB\-ascent \0\fR
.
@@ -196,9 +214,13 @@ above the baseline line plus the descent below the baseline.
.TP
\fB\-fixed \0\fR
.
-Returns a boolean flag that is ``\fB1\fR'' if this is a fixed-width font,
+Returns a boolean flag that is
+.QW \fB1\fR
+if this is a fixed-width font,
where each normal character is the same width as all the other
-characters, or is ``\fB0\fR'' if this is a proportionally-spaced font, where
+characters, or is
+.QW \fB0\fR
+if this is a proportionally-spaced font, where
individual characters have different widths. The widths of control
characters, tab characters, and other non-printing characters are not
included when calculating this value.
@@ -210,9 +232,13 @@ above:
\fB\-family \fIname\fR
.
The case-insensitive font family name. Tk guarantees to support the font
-families named \fBCourier\fR (a monospaced ``typewriter'' font), \fBTimes\fR
-(a serifed ``newspaper'' font), and \fBHelvetica\fR (a sans-serif
-``European'' font). The most closely matching native font family will
+families named \fBCourier\fR (a monospaced
+.QW typewriter
+font), \fBTimes\fR (a serifed
+.QW newspaper
+font), and \fBHelvetica\fR (a sans-serif
+.QW European
+font). The most closely matching native font family will
automatically be substituted when one of the above font families is used.
The \fIname\fR may also be the name of a native, platform-specific font
family; in that case it will work as desired on one platform but may not
@@ -286,17 +312,17 @@ Mac OS X:
Fill a text widget with lots of font demonstrators, one for every font
family installed on your system:
.CS
-pack [text .t -wrap none] -fill both -expand 1
+pack [text .t \-wrap none] \-fill both \-expand 1
set count 0
set tabwidth 0
-foreach family [lsort -dictionary [\fBfont families\fR]] {
- .t tag configure f[incr count] -font [list $family 10]
- .t insert end ${family}:\\t {} \\
- "This is a simple sampler\\n" f$count
- set w [\fBfont measure\fR [.t cget -font] ${family}:]
+foreach family [lsort \-dictionary [\fBfont families\fR]] {
+ .t tag configure f[incr count] \-font [list $family 10]
+ .t insert end ${family}:\\t {} \e
+ "This is a simple sampler\en" f$count
+ set w [\fBfont measure\fR [.t cget \-font] ${family}:]
if {$w+5 > $tabwidth} {
set tabwidth [expr {$w+5}]
- .t configure -tabs $tabwidth
+ .t configure \-tabs $tabwidth
}
}
.CE