GetShapedTextWidth
Text
Description
Measures Text in the named font and size with the same shaping pass that DrawShapedText uses and returns the resulting width in page units, so contextual forms and ligatures are already taken into account. Returns 0 when the shaping engine is unavailable or the face is not installed.
Syntax
Delphi
Function TPDFlib.GetShapedTextWidth(Const FontName: WideString; Size: Double; Const Text: WideString; Options: Integer): Double;
Parameters
FontName names an installed font face. Size is the text size in points. Text is the string to measure. Options bit 0 selects a right-to-left base paragraph direction, matching DrawShapedText
Return Values
Returns the shaped width of the text in page units - the sum of the shaped glyph advances - or 0 when the shaping engine is unavailable or the face is not installed
Remarks
The measurement runs the same shaping pass as DrawShapedText, so it reflects contextual forms and ligatures: a lam-alef pair measures as one ligature glyph, narrower than the two letters measured separately. Use it to right-align or centre shaped text before drawing