GETEXTENDEDTEXTMETRICS

Syntax

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

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

Parameter Type/Description  

hDC HDC Identifies the device context.  
lpInData WORD FAR * 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 data structure. See the following “Comments” section for a description of this data structure.  

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 field pointed to by the lpInData parameter. The return value is zero if the escape fails or is not implemented.

Comments

The lpOutData parameter points to an EXTTEXTMETRIC data structure which has the following format:

typedef struc{

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;

}EXTTEXTMETRIC;

The EXTTEXTMETRIC data structure has the following fields:

Field Description  

etmSize Specifies the size of the structure in bytes.  
etmPointSize Specifies the nominal point size of this font in twips (twentieths 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 field 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 over 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 over 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 etmMasterHeight. That is, etmMasterUnits is emtMasterHeight expressed in font units rather than device units.  
etmCapHeight Specifies the height in font units of uppercase characters in the font. Typically, this is the height of the capital H.  
etmXHeight Specifies the height in font units of lowercase characters in the font. Typically, this is the height of the lowercase x.  
etmLowerCaseAscent Specifies the distance in font units that the ascender of lowercase letters extends above the baseline. Typically, this is the height of the lowercase d.  
etmLowerCaseDescent Specifies the distance in font units that the descender of lowercase letters extends below the baseline. Typically, this is specified for the descender of the lower-case p.  
etmSlant Specifies for an italicized 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 baseline. This is typically a negative value.  
etmSubScript Specifies in font units the recommended amount to offset subscript characters from the baseline. 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 baseline 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 baseline where the top of the upper double underline bar should appear.  
etmDoubleLowerUnderlineOffset Specifies the offset in font units downward from the baseline 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 baseline where the top of a strike-out bar should appear.  
etmStrikeOutWidth Specifies the thickness in font units of the strike-out 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 kern 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 kern tracks.  

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