GetShapedTextWidth

Text

Description

This page describes GetShapedTextWidth in PDFlibPas under the "Text" topic. API names, parameters, class names, filenames, and literals are kept exactly as they appear in the Delphi library and DLL entry points.

Review the syntax, parameters, and return values before calling the function.

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.