[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] xlibconf: easy access to X11 font and color lookup



>>> Richard Jones wrote
> What're the chances of getting something similar for Windows? MacOS X 
> would be supported by xlibconf, I presume...

Well, assuming it's got TTF fonts installed somewhere with a fonts.dir
file, yes. It's quite likely that native MacOSX has some other functions
for saying 'gimme a list of fonts and their descriptions'.

Assuming Windows or MacOSX has some method of extracting a list of installed 
fonts and their descriptions, and someone can tell me what they are, 
I can make this stuff work pretty easily for them.

In any case, there's version 0.2 available now from 
http://www.interlink.com.au/anthony/tech/xlibconf.py/

New in this release:

  font selector values can be a list. Any values in the list will be matched.
So xlibconf.getFont(family=['arial', 'helvetica']) should get you something
useful on pretty much all systems.
 
  a PyGameFont class - a subclass of pygame.font.Font(), you can call
it with font selectors (rather than an explicit font path). You can also
call it's 'getFont(selector)' method to get a modified version of the font
with the appropriate selectors. For instance:

  helvfont = xlibconf.PyGameFont(family=['helvetica', 'arial'], 
                                 weight='medium', size=24)
  boldhelvfont = helvfont.getFont(weight='bold')

This will use the TTF font directly, rather than munging them as 
Font.set_bold() et.al do. This produces far higher quality output -
see http://www.interlink.com.au/anthony/tech/xlibconf.py/font-samples.png
for a screenshot showing how much better.

Anthony
-- 
Anthony Baxter     <anthony@interlink.com.au>   
It's never too late to have a happy childhood.

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org