`

DrawText

function DrawText(image: TImage32; x, y: double; const text: UnicodeString; TFontCache: TFontCache; textColor: TColor32 = clBlack32): double; overload;

function DrawText(image: TImage32; x, y: double; const text: UnicodeString; TFontCache: TFontCache; renderer: TCustomRenderer): double; overload;

function DrawText(image: TImage32; const rect: TRect; const text: UnicodeString; textAlign: TTextAlign; textAlignV: TTextVAlign; TFontCache: TFontCache; textColor: TColor32 = clBlack32): TPointD; overload;

  uses Img32, Img32.Text, Img32.Fmt.PNG;
  ...
  var
    img: TImage32;
    arialFont: TFontReader;
    arial12: TFontCache;
  begin
    FontManager.Load('Arial', 800);
    arialFont := FontManager.GetFont('Arial');

    arial12 := TFontCache.Create(arialFont, 12);
    img := TImage32.create(200, 50);
    try
      DrawText(img, 10,10, 'Img32!', arial12);
      img.SaveToFile('img32.png');
    finally
      img.Free;
      arial12.Free;
      //arialFont.Free; //managed by FontManager
    end;
  end;
      

See Also

TCustomRenderer, TFontCache, TTextAlign, TTextVAlign