[Pythonmac-SIG] list of fonts

Bob Ippolito bob at redivi.com
Sat Jul 17 16:50:00 CEST 2004


On Jul 17, 2004, at 9:34 AM, Arthur Elsenaar wrote:

> how do I get a list of the available system fonts? I tried doing this  
> in pygame, but the darwin code to do this is unimplemented. I see a  
> carbon.fm (font manager) module, but how does this work?

Using PyObjC:

import sys
import codecs
from AppKit import *
sys.stdout = codecs.getwriter('utf8')(sys.stdout)

fontManager = NSFontManager.sharedFontManager()
print u'\n'.join(fontManager.availableFonts())

See:
http://developer.apple.com/documentation/Cocoa/Reference/ 
ApplicationKit/ObjC_classic/Classes/NSFontManager.html#//apple_ref/doc/ 
uid/20000383/CJBDHJDJ

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3589 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040717/4c447378/smime.bin


More information about the Pythonmac-SIG mailing list