GETEXTENDEDTEXTMETRICS

short Escape(hdc, GETEXTENDEDTEXTMETRICS, sizeof(WORD),lpInData,lpOutData)

The GETEXTENDEDTEXTMETRICS printer escape fills the buffer pointed to by the lpOutData parameter with the extended text metrics for the selected font.

Parameters

hdc

HDC Identifies the device context.

lpInData

LPWORD Points to an unsigned 16-bit integer that specifies the number of bytes pointed to by the lpOutData parameter.

lpOutData

EXTTEXTMETRIC FAR * Points to an EXTTEXTMETRIC structure. For more information about this structure, see the following Comments section.

Return Value

The return value specifies the number of bytes copied to the buffer pointed to by the lpOutData parameter. This value will never exceed that specified in the nSize member pointed to by the lpInData parameter. The return value is zero if the selected font does not have the extended text metrics or if the escape fails or is not implemented.

Comments

The lpOutData parameter points to an EXTTEXTMETRIC structure, which has the following form:

struct EXTTEXTMETRIC {
    short etmSize;
    short etmPointSize;
    short etmOrientation;
    short etmMasterHeight;
    short etmMinScale;
    short etmMaxScale;
    short etmMasterUnits;
    short etmCapHeight;
    short etmXHeight;
    short etmLowerCaseAscent;
    short etmLowerCaseDescent;
    short etmSlant;
    short etmSuperScript;
    short etmSubScript;
    short etmSuperScriptSize;
    short etmSubScriptSize;
    short etmUnderlineOffset;
    short etmUnderlineWidth;
    short etmDoubleUpperUnderlineOffset;
    short etmDoubleLowerUnderlineOffset;
    short etmDoubleUpperUnderlineWidth;
    short etmDoubleLowerUnderlineWidth;
    short etmStrikeOutOffset;
    short etmStrikeOutWidth;
    WORD  etmKernPairs;
    WORD  etmKernTracks;
};

Following are the members in the EXTTEXTMETRIC structure:

etmSize

Specifies the size of the structure, in bytes.

etmPointSize

Specifies the nominal point size of this font, in twips (1/20 of a point, or 1/1440 inch). This is the intended size of the font; the actual size may differ slightly depending on the resolution of the device.

etmOrientation

Specifies the orientation of the font. The etmOrientation member may be any of the following values:

Value Meaning

0 Either orientation
1 Portrait
2 Landscape

These values refer to the ability of this font to be placed on a page with the given orientation. A portrait page has a height that is greater than its width. A landscape page has a width that is greater than its height.

etmMasterHeight

Specifies the font size, in device units, for which the values in this font's extent table are exact.

etmMinScale

Specifies the minimum valid size for this font. The following equation illustrates how the minimum point size is determined:

smallest point size = (etmMinScale * 72) / dfVertRes

The value 72 represents the number of points per inch. The dfVertRes value is the number of dots per inch.

etmMaxScale

Specifies the maximum valid size for this font. The following equation illustrates how the maximum point size is determined:

largest point size = (etmMaxScale * 72) / dfVertRes

The value 72 represents the number of points per inch. The dfVertRes value is the number of dots per inch.

etmMasterUnits

Specifies the integer number of units per em where an em equals the value of the etmMasterHeight member. (That is, etmMasterUnits is emtMasterHeight expressed in font units instead of device units.)

etmCapHeight

Specifies the height, in font units, of uppercase characters in the font. Typically, this is the height of capital H.

etmXHeight

Specifies the height, in font units, of lowercase characters in the font. Typically, this is the height of lowercase x.

etmLowerCaseAscent

Specifies the distance, in font units, that the ascender of lowercase letters extends above the base line. Typically, this is the height of lowercase d.

etmLowerCaseDescent

Specifies the distance, in font units, that the descender of lowercase letters extends below the base line. Typically, this is specified for the descender of lowercase p.

etmSlant

Specifies, for an italic or slanted font, the angle of the slant measured in tenths of a degree clockwise from the upright version of the font.

etmSuperScript

Specifies, in font units, the recommended amount to offset superscript characters from the base line. This is typically a negative value.

etmSubScript

Specifies, in font units, the recommended amount to offset subscript characters from the base line. This is typically a positive value.

etmSuperScriptSize

Specifies, in font units, the recommended size of superscript characters for this font.

etmSubScriptSize

Specifies, in font units, the recommended size of subscript characters for this font.

etmUnderlineOffset

Specifies, in font units, the offset downward from the base line where the top of a single underline bar should appear.

etmUnderlineWidth

Specifies, in font units, the thickness of the underline bar.

etmDoubleUpperUnderlineOffset

Specifies the offset, in font units, downward from the base line where the top of the upper double-underline bar should appear.

etmDoubleLowerUnderlineOffset

Specifies the offset, in font units, downward from the base line where the top of the lower double-underline bar should appear.

etmDoubleUpperUnderlineWidth

Specifies, in font units, the thickness of the upper underline bar.

etmDoubleLowerUnderlineWidth

Specifies, in font units, the thickness of the lower underline bar.

etmStrikeOutOffset

Specifies, in font units, the offset upward from the base line where the top of a strikeout bar should appear.

etmStrikeOutWidth

Specifies the thickness, in font units, of the strikeout bar.

etmKernPairs

Specifies the number of character kerning pairs defined for this font. An application can use this value to calculate the size of the pair-kern table returned by the GETPAIRKERNTABLE escape. It will not be greater than 512 kerning pairs.

etmKernTracks

Specifies the number of kerning tracks defined for this font. An application can use this value to calculate the size of the track-kern table returned by the GETTRACKKERNTABLE escape. It will not be greater than 16 kerning tracks.

The values returned in many of the members of the EXTTEXTMETRIC structure are affected by whether relative character widths are enabled or disabled. For more information, see the description of the ENABLERELATIVEWIDTHS escape earlier in this chapter.