[Lazarus] RE : How to I publish the SearchFont method of TFontManager?

silvioprog silvioprog at gmail.com
Mon Jun 20 20:50:15 CEST 2011

Thanks guys.

So, I did not want to re-implement a class only to verifier if one
font exists.  See my code below:

  VFreeTypeFont: TFreeTypeFont;
  VFPImageCanvas: TFPImageCanvas;
  VFreeTypeFont := TFreeTypeFont.Create;
  VFPImageCanvas := TFPImageCanvas.Create(AImage);
    VFreeTypeFont.Name := AFontName;
    VFreeTypeFont.Size := AFontSize;
    VFreeTypeFont.FPColor := AFontColor;

  { How to I check if my .ttf file exists without hack or
re-implementation of a class? }

    VFPImageCanvas.Font := VFreeTypeFont; <<-- if TTF font not exists
I receive an AV here.

Silvio Clécio
Blog - <silvioprog.com.br>
Twitter - <twitter.com/silvioprog>
LazSolutions - <code.google.com/p/lazsolutions>
LazWebSolutions - <code.google.com/p/lazwebsolutions>
Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR>
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *

More information about the Lazarus mailing list