DrawOpenTypeText
Text, fonts, OpenType shaping
Description
Shapes and draws Unicode text from the in-memory font program associated with an existing font handle
Syntax
Delphi
Function TPDFlib.DrawOpenTypeText(XPos, YPos: Double; FontID: Integer; Size: Double; Const Text: WideString; Options: Integer): Integer;Parameters
| XPos, YPos | The text origin in page units |
|---|---|
| FontID | A TrueType or OpenType font handle whose source font program is available |
| Size | The text size in points |
| Text | The Unicode text to shape and draw |
| Options | Bit 0 selects right-to-left direction; bit 1 forces the bounded Pascal fallback instead of the native OpenType engine |
Return values
Returns 1 when the shaped text is accepted and 0 for an invalid font, empty text, non-positive size, missing font program or shaping failure
Remarks
The portable native engine applies OpenType script shaping, GSUB substitutions, GPOS positioning and visual glyph ordering directly from the font bytes without requiring an installed system face
The bounded Pascal fallback supports cmap mapping, Arabic joining, default GSUB substitutions and common GPOS single, pair, cursive and mark attachment lookups when the native module is unavailable
The output uses a reusable Identity-H companion font, subsets the embedded program by glyph closure, retains required variable and colour-font tables, and writes source clusters to ToUnicode for extraction
Deploy PDFlibOpenType32.dll or PDFlibOpenType64.dll beside the executable on Windows; use libPDFlibOpenType.so on Linux or libPDFlibOpenType.dylib on macOS
PDFLIB_OPENTYPE_ENGINE may name an explicit native module path