GetOpenTypeTextWidth

Text, fonts, measurement, OpenType shaping

Description

Returns the horizontal advance of text after OpenType glyph substitution and positioning

Syntax

Delphi

Function TPDFlib.GetOpenTypeTextWidth(FontID: Integer; Size: Double; Const Text: WideString; Options: Integer): Double;

Parameters

FontIDA TrueType or OpenType font handle whose source font program is available
SizeThe requested text size in points
TextThe Unicode text to shape and measure
OptionsBit 0 selects right-to-left direction; bit 1 forces the bounded Pascal fallback

Return values

Returns the shaped advance in page units, or 0 for invalid input or a shaping failure

Remarks

The result uses the same glyph advances as DrawOpenTypeText, including ligatures, kerning, cursive attachment and font-unit scaling

The function reads the font program from FontID and does not require the font face to be installed on the operating system

See also

DrawOpenTypeText, GetOpenTypeGlyphRun