Probably over my head... Trying to get Font Names

Mike C. Fletcher mcfletch at rogers.com
Thu Feb 17 20:21:39 EST 2005


If you don't have a GUI library to use, TTFQuery+Fonttools will retrieve 
this information:

from ttfquery import _scriptregistry
fonts = _scriptregistry.registry.fonts.keys()
fonts.sort()
for name in fonts:
    print name

if you do have a GUI, your GUI library will almost certainly have a 
mechanism to retrieve the list of fonts.  With wxPython, for instance, 
it's called wxFontEnumerator.  If you just want the user to choose a 
font, most GUI libraries already have controls/dialogues that can handle it.

TTFQuery is going out, reading the .ttf fonts with Fonttools and storing 
their metadata in an index for faster access, whereas your GUI library 
will be using a simple API call to retrieve the metadata.  That means 
TTFQuery is going to be heavier, but it can, for instance, also give you 
information about fonts not installed on the system.

HTH,
Mike

TTFQuery:
    http://ttfquery.sourceforge.net/


Samantha wrote:

>I am attempting to extract the Font Names from the installed windows fonts. 
>I am having a heck of a time getting these rather than the file names. 
>Examples can be seen by going to Control Panel > Fonts
>
>Any help or direction is appreciated.
>S 
>  
>
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com
                              PyCon is coming...




More information about the Python-list mailing list