When I set the TFont
Name
property of a TRichEdit
control to "Courier" the font changes to Courier.
Edit->Font->Name = "Courier";
What if I want to use a font of which I'm not really sure it is supported on the system (e.g. on an older OS) ? As far as I can tell at the moment, if I assign an 'unknown' Name to the TFont property, the actual font doesn't change, the system takes care of it and sticks with the previous font, but how can I programmatically check this ?
I'd like to know if the font truly changed (because the font is available / installed) ?
Or do I need to query Screen->Fonts to find out if the Name is in the list ?
FYI: Using Borland C++ Builder (2009), but relevant to Delphi as well I'm sure.
TScreen::Fonts represents a TStrings
list that contains the names of the fonts installed in the system (the actual names and not the file names).
Use its IndexOf()
method to test if your font exists:
if (Screen->Fonts->IndexOf("Courier") != -1)
{
ShowMessage("Font installed");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With