Platform SDK: International Features

ScriptGetLogicalWidths

The ScriptGetLogicalWidths function converts the glyph advance widths for a specific font into logical widths.

HRESULT WINAPI ScriptGetLogicalWidths(
  const SCRIPT_ANALYSIS *psa,
  int cChars,
  int cGlyphs,
  const int *piGlyphWidth,
  const WORD *pwLogClust,
  const SCRIPT_VISATTR *psva,
  int *piDx,
);

Parameters

psa
[in] Pointer to a SCRIPT_ANALYSIS structure.
cChars
[in] Count of the logical code points in the run.
cGlyphs
[in] Count of the glyphs in a run.
piGlyphWidth
[in] Pointer to an array of glyph advance widths.
pwLogClust
[in] Pointer to an array of logical clusters.
psva
[in] Pointer to a SCRIPT_VISATTR structure.
piDx
[out] Pointer to an array of logical widths.

Return Values

Currently, ScriptGetLogicalWidths always returns S_OK.

Remarks

ScriptGetLogicalWidths is useful for recording widths in a font-independent manner. ScriptGetLogicalWidths converts the glyph advance widths calculated for a specific font into logical widths, one per code point, in the same order as the code points. If the same string is then displayed on a different device using a different font, the logical widths may be applied, by using ScriptApplyLogicalWidth, to approximate the original placement. This would be useful when implementing print preview—on the preview screen it is important to match the layout and placement of the final printed result.

Ligature glyph widths are divided evenly among the characters they represent.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Usp10.h.
  Library: Use Usp10.lib.

See Also

Uniscribe Overview, Uniscribe Functions, ScriptApplyLogicalWidth, SCRIPT_ANALYSIS, SCRIPT_VISATTR