2008. július 28., hétfő

Is font "X" installed?


Problem/Question/Abstract:

How to determine if a font is installed

Answer:

You can just use this function, or put the code directly wherever you need it

function FontInstalled(const FontName: string): Boolean;
begin
  Result := Screen.Fonts.IndexOf(FontName) > 0
end;

then just call it

if not (FontInstalled('Pilobolus')) then
begin
  ShowMessage('Pilobolus font is not installed!')
    //you can do stuff here to install it, or whatever you need...
end;

Nincsenek megjegyzések:

Megjegyzés küldése