THPDFPage.UnicodeTextOut

THPDFPage

 

Top  Previous  Next

Shows text represented by a Unicode string or buffer.

 

This procedure is retained for backward compatibility and shares the current TextOut font pipeline. Use it when existing code already passes WideString or UTF-16 buffers.

 

Delphi syntax:

procedure UnicodeTextOut( X, Y: Single; Angle: Extended; Text: PWORD; TextLength: Integer ); overload;

procedure UnicodeTextOut( X, Y: Single; Angle: Extended; Text: WideString ); overload;

 

Description:

This procedure prints a text line represented by a Unicode buffer ( Text: PWORD, TextLength: Integer ) or Unicode string ( Text: WideString ) from point X, Y using orientation Angle in degrees.

 

For embedded Unicode fonts, HotPDF now refreshes glyph state when the font changes, resolves glyph IDs from the active Windows font, and writes matching ToUnicode data for the generated PDF. This improves cross-viewer rendering for embedded fonts such as Calibri.

 

When the active font has first been loaded with RegisterUnicodeTTF, supplementary-plane Unicode characters such as U+1F600 are resolved through the font's cmap format 12 data and emitted as one internal CID in the page text stream. Page output reuses the registered Type 0 font resource, so finalization refreshes the same /CIDToGIDMap, descendant font /W, /ToUnicode, and font-subset usage state used by AcroForm Unicode appearance streams.

 

Demo\Delphi\FontTest provides a practical comparison sample for TextOut and embedded font validation.

 

Code Example

HPDF.FontEmbedding := true;
HPDF.StandardFontEmulation := false;
HPDF.CurrentPage.SetFont( 'Arial Unicode MS', [], 12, 0, False );
HPDF.CurrentPage.UnicodeTextOut( 40, 100, 0, WideString('Unicode output sample') );