Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_Paths🞂TCanvas32🞂RenderTextMethod

TCanvas32.RenderText

Converts text outlines into vector path geometry and appends them to the canvas path.

Declarations ​

pascal
procedure RenderText(X, Y: TFloat; const Text: string); overload;
procedure RenderText(X, Y: TFloat; const Text: string; Flags: Cardinal); overload;
procedure RenderText(X, Y: TFloat; const Text: string; const Layout: TTextLayout); overload;
procedure RenderText(const DstRect: TFloatRect; const Text: string; Flags: Cardinal); overload;
procedure RenderText(const DstRect: TFloatRect; const Text: string; const Layout: TTextLayout); overload;
Overload Details

Overload 1 ​

pascal
procedure RenderText(X, Y: TFloat; const Text: string); overload;

Renders text at position (X, Y) using default text layout settings.

ParameterTypeDescription
X, YTFloatText baseline origin coordinates.
TextstringText string to render.

Overload 2 ​

pascal
procedure RenderText(X, Y: TFloat; const Text: string; Flags: Cardinal); overload;

Renders text at position (X, Y) using text alignment flags.

ParameterTypeDescription
X, YTFloatText baseline origin coordinates.
TextstringText string to render.
FlagsCardinalWin32 DrawText-compatible formatting flags (e.g., DT_CENTER, DT_VCENTER).

Overload 3 ​

pascal
procedure RenderText(X, Y: TFloat; const Text: string; const Layout: TTextLayout); overload;

Renders text at position (X, Y) using a TTextLayout structure.

ParameterTypeDescription
X, YTFloatText baseline origin coordinates.
TextstringText string to render.
LayoutTTextLayoutText layout configuration.

Overload 4 ​

pascal
procedure RenderText(const DstRect: TFloatRect; const Text: string; Flags: Cardinal); overload;

Renders text formatted within destination rectangle DstRect using text formatting flags.

ParameterTypeDescription
DstRectTFloatRectDestination rectangle for text layout and alignment.
TextstringText string to render.
FlagsCardinalFormatting flags controlling text alignment and line wrapping.

Overload 5 ​

pascal
procedure RenderText(const DstRect: TFloatRect; const Text: string; const Layout: TTextLayout); overload;

Renders text formatted within destination rectangle DstRect using a TTextLayout structure.

ParameterTypeDescription
DstRectTFloatRectDestination rectangle for text layout and alignment.
TextstringText string to render.
LayoutTTextLayoutText layout configuration.

Description ​

RenderText converts character font outlines into vector path contours and appends them to the active canvas path.

Font outlines are converted using backend text-to-path interfaces (ITextToPathSupport or ITextToPathSupport2) supported by the target Bitmap backend.

The converted glyph contours are drawn using the current canvas brushes and polygon renderer.

Example ​

pascal
var
  Canvas: TCanvas32;
  SolidBrush: TSolidBrush;
begin
  Canvas := TCanvas32.Create(MyBitmap);
  try
    SolidBrush := TSolidBrush(Canvas.Brushes.Add(TSolidBrush));
    SolidBrush.FillColor := clBlack32;

    // Render text string at coordinate (20, 40)
    Canvas.RenderText(20.0, 40.0, 'Hello Graphics32!');
  finally
    Canvas.Free;
  end;
end;