font.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:13k
- '"
- '" Copyright (c) 1996 Sun Microsystems, Inc.
- '" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
- '"
- '" 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.3.8.3 2007/11/05 17:21:58 dgp Exp $
- '"
- .so man.macros
- .TH font n 8.0 Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- font - Create and inspect fonts.
- .SH SYNOPSIS
- fBfontfI option fR?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- The fBfontfR command provides several facilities for dealing with
- 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 fIfontfR ?fB-displayof fIwindowfR? ?fIoptionfR?
- .
- Returns information about the actual attributes that are obtained when
- fIfontfR is used on fIwindowfR's display; the actual attributes obtained
- may differ from the attributes requested due to platform-dependent
- limitations, such as the availability of font families and pointsizes.
- fIfontfR is a font description; see FONT DESCRIPTIONS below. If the
- fIwindowfR argument is omitted, it defaults to the main window. If
- fIoptionfR 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.
- .TP
- fBfont configure fIfontnamefR ?fIoptionfR? ?fIvalue option value ...fR?
- .
- Query or modify the desired attributes for the named font called
- fIfontnamefR. If no fIoptionfR is specified, returns a list describing
- all the options and their values for fIfontnamefR. If a single fIoptionfR
- is specified with no fIvaluefR, then returns the current value of that
- attribute. If one or more fIoptionfR-fIvaluefR 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
- possible attributes.
- .TP
- fBfont createfR ?fIfontnamefR? ?fIoption value ...fR?
- .
- Creates a new named font and returns its name. fIfontnamefR specifies the
- name for the font; if it is omitted, then Tk generates a new name of the
- form fBfontfIxfR, where fIxfR is an integer. There may be any number
- of fIoptionfR-fIvaluefR pairs, which provide the desired attributes for
- the new named font. See FONT OPTIONS below for a list of the possible
- attributes.
- .TP
- fBfont deletefR fIfontnamefR ?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
- 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 createfR, the widgets will use the new named font
- and redisplay themselves using the new attributes of that font.
- .TP
- fBfont familiesfR ?fB-displayof fIwindowfR?
- .
- The return value is a list of the case-insensitive names of all font families
- that exist on fIwindowfR's display. If the fIwindowfR argument is
- omitted, it defaults to the main window.
- .TP
- fBfont measure fIfontfR ?fB-displayof fIwindowfR? fItextfR
- .
- Measures the amount of space the string fItextfR would use in the given
- fIfontfR when displayed in fIwindowfR. fIfontfR is a font description;
- see FONT DESCRIPTIONS below. If the fIwindowfR argument is omitted, it
- defaults to the main window. The return value is the total width in pixels
- of fItextfR, not including the extra pixels used by highly exaggerated
- characters such as cursive ``f''. If the string contains newlines or tabs,
- those characters are not expanded or treated specially when measuring the
- string.
- .TP
- fBfont metrics fIfontfR ?fB-displayof fIwindowfR? ?fIoptionfR?
- .
- Returns information about the metrics (the font-specific data), for
- fIfontfR when it is used on fIwindowfR's display. fIfontfR is a font
- description; see FONT DESCRIPTIONS below. If the fIwindowfR argument is
- omitted, it defaults to the main window. If fIoptionfR 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.
- .TP
- fBfont namesfR
- The return value is a list of all the named fonts that are currently defined.
- .SH "FONT DESCRIPTION"
- .PP
- The following formats are accepted as a font description anywhere
- fIfontfR is specified as an argument above; these same forms are also
- permitted when specifying the fB-fontfR option for widgets.
- .TP
- [1] fIfontnamefR
- .
- The name of a named font, created using the fBfont createfR command. When
- a widget uses a named font, it is guaranteed that this will never cause an
- error, as long as the named font exists, no matter what potentially invalid
- or meaningless set of attributes the named font has. If the named font
- cannot be displayed with exactly the specified attributes, some other close
- font will be substituted automatically.
- .TP
- [2] fIsystemfontfR
- .
- 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''
- 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.
- .VS 8.0 br
- .TP
- [3] fIfamily fR?fIsizefR? ?fIstylefR? ?fIstyle ...fR?
- .
- A properly formed list whose first element is the desired font
- fIfamilyfR and whose optional second element is the desired fIsizefR.
- The interpretation of the fIsizefR attribute follows the same rules
- described for fB-sizefR in FONT OPTIONS below. Any additional optional
- arguments following the fIsizefR are font fIstylefRs. Possible values
- for the fIstylefR arguments are as follows:
- .RS
- .DS
- .ta 3c 6c 9c
- fBnormal bold roman italic
- underline overstrikefR
- .DE
- .RE
- .TP
- [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-encodingfR.
- 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
- 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''
- was in fact one pixel and would display incorrectly (generally larger) if
- the correct size font were actually used.
- .VE
- .TP
- [5] fIoption value fR?fIoption value ...fR?
- .
- A properly formed list of fIoptionfR-fIvaluefR pairs that specify
- the desired attributes of the font, in the same format used when defining
- a named font; see FONT OPTIONS below.
- .LP
- When font description fIfontfR is used, the system attempts to parse the
- description according to each of the above five rules, in the order specified.
- Cases [1] and [2] must match the name of an existing named font or of a
- system font. Cases [3], [4], and [5] are accepted on all
- platforms and the closest available font will be used. In some situations
- it may not be possible to find any close font (e.g., the font family was
- a garbage value); in that case, some system-dependent default font is
- chosen. If the font description does not match any of the above patterns,
- an error is generated.
- .SH "FONT METRICS"
- .
- The following options are used by the fBfont metricsfR 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
- horizontal line where the bottom of most letters line up; certain letters,
- such as lower-case ``g'' stick below the baseline.
- .TP
- fB-ascent