1. pygame
  2. pygame
  3. pygame


Issue #179 closed

Need to update system font lists in sysfont.py (2013)

Jason Marshall
created an issue

The system font lists for Windows and OS X are out-of-date. Update per the following:

OS X font locations: http://support.apple.com/kb/HT2435

Mac OS X 10.3 list: http://support.apple.com/kb/HT2444

Mac OS X 10.4 list: http://support.apple.com/kb/HT1538

Mac OS X 10.5 list: http://support.apple.com/kb/HT1642

Mac OS X 10.6 list: http://support.apple.com/kb/ht5154

Mac OS X 10.7 list: http://support.apple.com/kb/HT5098

OS X 10.8 list: http://support.apple.com/kb/ht5379

OS X 10.9 list: http://support.apple.com/kb/HT5944

Windows font lists: http://www.microsoft.com/typography/fonts/


Comments (18)

  1. Jason Marshall reporter

    Dan Ross Thanks for reporting your issue. I haven't installed OS X 10.9 yet, so I haven't seen your issue first-hand. I won't get to it for a few months, so if you want to figure it out and patch it, that would be great!

  2. René Dudfield

    I added a fix for the fc-list hang in OSX in commit 4ed9cb7. However it still requires the optional X11 to be installed.

    There is a list of ways to list fonts on OS X at this url. http://stackoverflow.com/questions/1113040/list-of-installed-fonts-os-x-c

    Maybe the Cocoa code in there could be done via ctypes, so as to not require PyObjC (which isn't installed everywhere).

    Otherwise there is some half finished code in sysfont which doesn't require any dependencies. It simply lists directories where fonts are. What needs to be added is a check against a list of hard coded family information (gathered from systems with fc-list installed).

  3. Jason Marshall reporter

    fc-list output on Mac OS X 10.3.9 with X11 installed from the install discs. No other extra options (such as extra fonts) or extra programs installed. fc-list didn't run from the Terminal app; I had to use the XTerm that comes with X11. It probably has to do with the environment's search path.

  4. Jason Marshall reporter
    • edited description

    Here's an idea: rather than maintaining a full list of all fonts installed by default for all supported operating systems, we could shorten the OS font lists to contain just default fonts for serif, sans-serif and monospace families. I think this would be more maintainable.

  5. Jason Marshall reporter

    I like the way Tk handles font options. I am thinking that sysfont.py should offer similarly-limited functionality.

    Here's an excerpt from the Tk font documentation:

    -family name

    The case-insensitive font family name. Tk guarantees to support the font families named Courier (a monospaced "typewriter" font), Times (a serifed "newspaper" font), and Helvetica (a sans-serif "European" font). The most closely matching native font family will automatically be substituted when one of the above font families is used. The name may also be the name of a native, platform-specific font family; in that case it will work as desired on one platform but may not display correctly on other platforms. If the family is unspecified or unrecognized, a platform-specific default font will be chosen.

  6. Jason Marshall reporter

    Removed hard-coded font lists. They're not necessary, and updating them every time that a new OS is released would be a burden. Now, sysfont will depend on the registry (on Windows) or X11 fc-list (on any other OS) to generate a system's font list. Ad-hoc tested sysfont changes on Windows 7 with Python 2.4 and 3.4. Tested on Mac OS X 10.4 with Python 2.7. Close #179. Processed with autopep8.

    → <<cset ae2e36dc3f4c>>

  7. Log in to comment