Important: The information in this document is obsolete and should not be used for new development.
CharWidth
TheCharWidthfunction returns the width in pixels of the specified character.
FUNCTION CharWidth (ch:\xDDCHAR): Integer;
ch- The character whose width is to be measured.
DESCRIPTION
TheCharWidthfunction includes the effects of the stylistic variations for the text set in the current graphics port. If you change any of these attributes after determining the glyph width but before actually drawing it, the predetermined width may not be correct. For a space character,CharWidthalso includes the effect ofSpaceExtra. For a nonspace character,CharWidthincludes the effect ofCharExtra. For more information, see "Individual Glyphs" on page 3-28.SPECIAL CONSIDERATIONS
Because it takes a single-byte value as thechparameter,CharWidthworks only for 1-byte simple script systems.A series of calls to
CharWidthin a contextual 1-byte font may give incorrect results, because the width of a text segment may be different from the sum of its individual character widths. In that case, to measure a line of text you should callTextWidth.Do not use the
CharWidthfunction for 2-byte script systems. If you want to measure the width of a single glyph in a 2-byte font, you should useTextWidth.
 
  
  
 