TFontCache

TFontCache dramatically improves text rendering performance over directly accessing TFontReader objects. Font files only need to be parsed once for each character accessed, and the glyph data returned is cached for later reuse.

const
  text = 'some text';
var
  image       : TImage32;
  rec         : TRect;
  arialReader  : TFontReader;
  arial14Cache: TFontCache;
begin
  ... 
  //The following line of code assumes compiling to the Windows platform.
  //For cross-platform applications, consider storing the font in the
  //application's resource section, and loading it from there.
  arialReader := TFontReader.Create('Arial'); 
  //create a font cache for arialReader (with font height 14)
  arial14Cache := TFontCache.Create(arialReader, DpiAware(14));
  try
    //now do something with arial14Cache
    DrawText(image, rec, text, taCenter, tvaMiddle, arial14Cache);
  finally
    //clean up
    arialReader.Free;
    arial14Cache.Free;
  end;
      

Reference

Methods Properties
Clear Ascent
Create Descent
Destroy FontHeight
GetAngledTextGlyphs FontReader
GetCharInfo InvertY
GetCharOffsets Kerning
GetTextCodePoints LineHeight
GetTextOutline Scale
GetTextWidth StrikeOut
GetUnderlineOutline Underlined