THPDFPage.RtLTextOut Method

 

THPDFPage.RtLTextOut

THPDFPage

 

Top  Previous  Next

Prints Right-to-Left (RTL) text with proper bidirectional text processing.

 

Delphi syntax:

procedure RtLTextOut ( X, Y: Single; Angle: Extended; Text: PWORD);

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

 

C++ syntax:

void __fastcall RtLTextOut ( float X, float Y, Extended Angle, PWORD Text);

void __fastcall RtLTextOut ( float X, float Y, Extended Angle, WideString Text);

 

Description:

This procedure prints Right-to-Left (RTL) text with proper bidirectional text processing. It supports languages such as Arabic and Hebrew by applying segment-based processing: RTL segments maintain their original order while LTR segments are reversed internally for correct display. The PDF document's reading direction is automatically set to RightToLeft.

 

Key Features:

• Segment-based bidirectional text processing

• Automatic PDF direction setting to RightToLeft

• Support for mixed RTL/LTR content

• Compatible with PWORD and WideString parameters

• Proper Unicode character handling

 

Code Example

// Arabic text example
var
  ArabicText: WideString;
begin
  ArabicText := 'مرحبا بالعالم';
  HPDF.CurrentPage.SetFont( 'Arial Unicode MS', [], 12 );
  HPDF.CurrentPage.RtLTextOut( 150, 200, 0, ArabicText );
end;

// Mixed RTL/LTR text example
var
  MixedText: WideString;
begin
  MixedText := 'Hello مرحبا World';
  HPDF.CurrentPage.SetFont( 'Arial Unicode MS', [], 12 );
  HPDF.CurrentPage.RtLTextOut( 150, 180, 0, MixedText );
end;

 

Technical Notes:

• RtLTextOut applies segment-based processing: RTL segments maintain original order, LTR segments are reversed internally

• PDF reading direction is automatically set to RightToLeft for proper viewer display

• Supports both PWORD and WideString parameters for maximum compatibility

• Requires Unicode-capable fonts for proper RTL character rendering

 

See also: SetFont, UnicodeTextOut, TextOut.