ScriptGetLogicalWidths function (usp10.h)

Converts the glyph advance widths for a specific font into logical widths.

Syntax

HRESULT ScriptGetLogicalWidths(
  [in]  const SCRIPT_ANALYSIS *psa,
  [in]  int                   cChars,
  [in]  int                   cGlyphs,
  [in]  const int             *piGlyphWidth,
  [in]  const WORD            *pwLogClust,
  [in]  const SCRIPT_VISATTR  *psva,
  [out] int                   *piDx
);

Parameters

[in] psa

Pointer to a SCRIPT_ANALYSIS structure.

[in] cChars

Count of the logical code points in the run.

[in] cGlyphs

Count of the glyphs in the run.

[in] piGlyphWidth

Pointer to an array of glyph advance widths.

[in] pwLogClust

Pointer to an array of logical clusters.

[in] psva

Pointer to a SCRIPT_VISATTR structure defining visual attributes.

[out] piDx

Pointer to an array of logical widths.

Return value

Currently returns S_OK in all cases.

Remarks

This function is useful for recording widths in a font-independent manner. It 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 can be applied by using ScriptApplyLogicalWidth to approximate the original placement. This mechanism is useful when implementing print preview. On the preview screen, it is important to match the layout and placement of the final printed result.

Note  Ligature glyph widths are divided evenly among the characters they represent.
 
Important  Starting with Windows 8: To maintain the ability to run on Windows 7, a module that uses Uniscribe must specify Usp10.lib before gdi32.lib in its library list.
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header usp10.h
Library Usp10.lib
DLL Usp10.dll
Redistributable Internet Explorer 5 or later on Windows Me/98/95

See also

SCRIPT_ANALYSIS

SCRIPT_VISATTR

ScriptApplyLogicalWidth

Uniscribe

Uniscribe Functions