make-font-ex

Function

Package: common-graphics

Arguments: family face size &optional style size-is-cell-height-p

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

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:

See also ask-user-for-font and vary-font.

Font sizes

You may notice noticed 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.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.