Check for a valid font name - Python

Hi all- as far as I can see

sc.doc.Fonts.FindOrCreate( Blarg, False, False)

is happy to add ‘Blarg’ to the font table whether or not it is a legitimate font face… How can I check that the name ‘Blarg’ actually refers to a font on the system?

thanks,

-Pascal

Does this help?

Thanks, Dale, looks like that will work.

-Pascal

Cool, thanks Dale, I needed something like that awhile back as well…! --Mitch

import System
ff=System.Drawing.Text.InstalledFontCollection().Families
font_names=[font.Name for font in ff]
1 Like