The attributes of fonts are contained in the FONTMETRICS data structure. The appearance of the actual text is influenced also by the attributes of the individual characters, which can be found in the CHARBUNDLE data structure.
An application can determine whether to use a particular font by examining its font metrics, which are the measurements that define the features of that font. The measurements are decided on by a font designer, whose most important criteria might be ensuring that the font is pleasing to the eye.
Unlike the attributes of a character string primitive, the individual font metrics attributes cannot be changed using specific GPI functions. Your application can determine the values of the current logical font attributes by calling GpiQueryFontMetrics, which accepts as input the amount of data to be returned as well as a pointer to the data area. Unlike other GPI calls, GpiQueryFontMetrics does not return the size necessary for all font metrics data. Querying with a sizeof operator, instead of calling the query twice, returns the size data.
The following table and text defines and explains the uses of the various font metric attributes.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³Attribute ³Description ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Face name ³The full typeface name of a ³ ³ ³font, such as Courier Bold ³ ³ ³Italic. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Family name ³A broader equivalent of the ³ ³ ³face name (e.g.Courier). ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Code page ³The mapping between a set of ³ ³ ³codepoints and a set of ³ ³ ³graphic characters. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Character cell ³Controls the height and width ³ ³ ³of outline font characters. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Character cell ascent ³Distance between the baseline ³ ³ ³to the top of the character ³ ³ ³cell. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Character cell descent ³Distance between the baseline ³ ³ ³and the bottom of the ³ ³ ³character cell. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Maximum baseline extent ³Maximum vertical extent of ³ ³ ³font characters in world ³ ³ ³coordinates. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Maximum ascender ³Maximum distance a font ³ ³ ³character ascends above the ³ ³ ³baseline. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Maximum descender ³Maximum distance a font ³ ³ ³charter descends below the ³ ³ ³baseline. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Internal leading ³Vertical distance equal to the³ ³ ³difference between the maximum³ ³ ³baseline extent and the em ³ ³ ³height. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Em height ³Equivalent to the character ³ ³ ³cell height. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Em width ³Equivalent to the character ³ ³ ³cell width. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³X height ³Height above the baseline of ³ ³ ³any lowercase character. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Lowercase ascent ³Maximum distance of a ³ ³ ³lowercase character above the ³ ³ ³baseline. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Lowercase descent ³Maximum distance of a ³ ³ ³lowercase character below the ³ ³ ³baseline. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³External leading ³Maximum vertical font spacing ³ ³ ³that can be added without ³ ³ ³adversely affecting the ³ ³ ³appearance of the text. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Average character width ³Average width of font ³ ³ ³characters in world ³ ³ ³coordinates ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Character slope ³Initial slope of a character ³ ³ ³with respect to a vertical ³ ³ ³line. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Inline direction ³Character angle measured with ³ ³ ³respect to a horizontal line. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³Weight class ³Specifies the thickness of ³ ³ ³each stroke of a font ³ ³ ³character. ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³First, last, default, and ³See the topic Glyphs, Code ³ ³break characters ³Pages and Code Points. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The face name attribute is the typeface name by which a particular font design is known. Two examples are Times New Roman Bold and Times New Roman Italic. Roman is the family name of these fonts. You always should provide a face name because most outline fonts are known by it.
The code page to be associated with the font is identified by this metric. Some fonts are specific to a particular code page and should be used with only that code page. Other fonts are universal and can be used with any supported code page.
Every character in a font is drawn within a rectangular region called a character cell. The character-cell height is the distance from the bottom of the character cell to its top. The width of the character cell is the distance from one side to the other.
An imaginary horizontal line, called a baseline, is drawn through the lower portion of the character cell. The operating system uses the baseline to position characters. All uppercase and most lowercase letters in a given font rest approximately on the baseline. Some lowercase letters, such as g and y, descend below the baseline.
The distance from the baseline to the top of the character cell is the character-cell ascent. Similarly, the character-cell descent is the distance from the baseline to the bottom of the character cell. The following figure illustrates characters drawn along a baseline inside their character cells. Various font metrics also are illustrated.
Some Font Metrics
The maximum baseline extent is the sum of the maximum ascender and the maximum descender values. The internal leading is the space allowed for diacritics above capital letters. When an application draws a string of text, the operating system positions the leftmost point of the baseline over a predetermined point for each character in the string.
A font's Em height is a measure of its visual height. This measurement was given its name because, historically, the height of an uppercase letter M usually was equal to the average height of all uppercase characters in the font. However, this is no longer the case.
The value of Em height represents the font point size in world coordinates and is the same as the character cell height. For an outline font, this can be set by the character cell height attribute. The value of Em Width is the equivalent horizontal dimension and is the same as the character cell width. For an outline font this also can be set by the character cell width attribute. These are, in fact, the dimensions of the em square (a typographic term) and, like point size, cannot be defined in terms of any measurable characteristic of a visible character of the font.
The average distance from the baseline to the top of any lowercase character is called a font's x height. This measurement was given its name because the height of a lowercase x usually is equal to the average height of all lowercase characters in the font.
The maximum ascender is the height of the tallest character in a font. The maximum descender is the depth (below the baseline) of the lowest character in a font.
The lowercase ascent is the height of the tallest lowercase character in a font. The lowercase descent is the depth (below the baseline) of the lowest lowercase character in a font.
Many fonts reserve part of the space in the top of each character cell for accent marks. This reserved space is called internal leading. Some fonts require a certain amount of space to be left between rows of text. This space, called external leading, is not included in the character-cell height or ascent measurements. The external leading is the recommended space to leave between rows of text to preserve its pleasing appearance.
The average character width is stored in the lAveCharWidth field in the FONTMETRICS structure. The average character width is a measure of character width based on the normal frequency of lowercase letter usage in the English language. You can use this value to approximate the average width of a character in string length calculations.
The maximum baseline extent for a font is the sum of the maximum ascender and the maximum descender. Maximum baseline extent is not equal to cell height for outline fonts, but is for image fonts.
The character slope is an angle measured clockwise with respect to a typical vertical line. The slope of a normal font is 0; the slope of an italic font is other than 0. The character slope in the FONTMETRICS data structure can be thought of as the initial slope, since the slope can be changed in the CHARBUNDLE data structure.
The inline direction is an angle measured clockwise with respect to a horizontal line. The inline direction for a Swiss, Helvetica, or Roman font is normally 0-exactly horizontal. The inline direction for a Hebrew font is normally 180, because Hebrew text is oriented right to left.
The character-rotation angle is an angle measured counterclockwise with respect to a horizontal line. The baselines of characters are aligned with the vector drawn at the angle of rotation.
The weight class specifies the thickness of each stroke that forms part of each character in a font.
The first, last, default, and break character all are associated with glyphs for UGL fonts and code pages.
A superscript is a character drawn immediately above and to the right of a normal character in a string of text. Superscripts are identified by a width and height and by vertical and horizontal offsets.
A subscript is a character drawn immediately below and to the right of a normal character in a string of text. Subscripts are identified by a width and height and by vertical and horizontal offsets.