How can I test if a font is installed?
Ultimately, I want to implement a HTML-like font selection, i.e. when specifying e.g. "Verdana,Arial", it should pick the first font that is installed.
This Question provides an answer for .NET - it seems the recommended way is to create the font, and then cmpare the font face actually used.
Is that the most efficient way?
You can either try to create the font and see what you get (thus using the OS's font name matching/substitution).
Or you can enumerate installed fonts and do that matching yourself.
The "most efficient" way will depend on the details of a "match", and, in all likelihood, how many fonts are installed. On a system with, say, 50 fonts you will probably find performance is significantly different to a system with 1000 fonts installed.
In the end you can only profile on representative systems, if you first approach (keep it simple) turns out to be a performance bottleneck.
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