| Allegro CL version 7.0 Object described on page has changed in 7.0. | |||||||||
Arguments: family face size &optional style size-is-cell-height-p angle
Both make-font and make-font-ex return a font object with the given components. family and face specify the family and face of the font. The two functions differ only in the interpretation of the size of a font. See below under the heading Font sizes for information on size and the size-is-cell-height-p argument to make-font-ex.
Other than size, fonts are canonicalized so that those with the same components are eq.
The family argument is a general specification for the style of the font, and is used only if the requested face is not installed in the operating system. It may be one of the symbols
:swiss: variable-width fonts without serifs
:roman: variable-width fonts with serifs
:modern: fixed-width fonts, with or without serifs
:script: fonts designed to look like cursive handwriting
:decorative: novelty fonts, such as Old English
or else nil if there is no preference.
The face argument specifies the unique name of an individual typeface that may be installed in the operating system. The name may be a string or symbol, though a string is now preferred and the symbol option is provided mainly for backward compatibility. The string is not case sensitive. If the requested face is not installed, then a default face for the requested family is used.
A list of all currently installed font face names is returned by the
form (see font-faces, screen, and *system*):
(font-faces (screen *system*))
If the exact font that was requested is not available, the operating system substitutes an approximate font. Once the returned font has been assigned to a stream by calling (setf font), exact-font may be called on the font to return a font object whose family, face, size, and other attributes reflect the actual font being used.
The style may be either a list of any of the
style keywords shown below, or a single number derived by
adding the associated weights, or nil to
indicate none of the optional styles. The keywords and their integer
equivalents are:
:bold style has weight 1.
:italic style has weight 2.
:underline style has weight 4.
:condensed style has weight 32.
The angle argument specifies the angle at which
to draw all strings that are drawn in this font. If nil or unspecified, then text is drawn at the usual
horizontal angle. Otherwise angle should be an integer indicating
degrees counterclockwise to rotate text from the usual horizontal
angle. (So 90 for vertical, first letter lowest, 180 for upside down,
and 270 for vertical, first letter highest. These are examples; angles
which are not multiples of 90 are also supported.) The text will be
rotated about the upper-left corner of the string. draw-string-in-box is therefore not suitable for
drawing text at non-zero angles, and Common Lisp stream output
functions such as format and
princ should be used instead;
these functions which will draw from the current-position of the stream at the angle of
the font. font-angle applied
to a font returns the angle.
See also ask-user-for-font and vary-font.
You may notice that the size specified to a Common Font dialog
is different from the size specified to make-font to get the same
result. For example, if you call ask-user-for-font (which displays a
Common Font dialog), and ask for Times regular, size 11, you get the
same font as returned by (make-font :roman :times
17).
Why the difference? There are two causes: first, Allegro CL measures font sizes in pixels while the Common Dialog measures in points; and second, the size shown in the Common Dialog indicates the "character height" (the height of the pixels that are actually drawn for a character) while the size used by make-font indicated the "cell height" (the character height plus an unpredictable number of blank pixel rows of "leading").
The function make-font-ex harmonizes Allegro CL with the Windows Common Font dialog. It uses character height rather than cell height (unless the size-is-cell-height-p optional argument is specified true, which forces the older cell-height interpretation and makes make-font-ex equivalent to make-font). The units are still pixels, though, rather than points.
Font objects are printed #.([make-font-form])
or #.([make-font-ex-form]). Every font
created by make-font prints as
#.([make-font-form]).
Fonts made by make-font-ex print as
#.([make-font-ex-form]) or
#.([make-font-form]) depending on which
definition of size is used (controlled by the
size-is-cell-height-p optional argument).
A font returned by a Common Font dialog prints as a make-font-ex form. Fonts made or created from other existing fonts will use the format of the starting font.
See also Text and Fonts in cg-drawing.htm.
Copyright (c) 1998-2006, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 7.0. The object described on this page has been modified in the 7.0 release; see the Release Notes.
Created 2005.9.20.
| Allegro CL version 7.0 Object described on page has changed in 7.0. | |||||||||