Need to update system font lists in (2013)

Issue #179 closed
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:

Mac OS X 10.3 list:

Mac OS X 10.4 list:

Mac OS X 10.5 list:

Mac OS X 10.6 list:

Mac OS X 10.7 list:

OS X 10.8 list:

OS X 10.9 list:

Windows font lists:

Comments (25)

  1. Dan Ross

    Is this issue causing fc-list to hang by any chance? Using OS X 10.9, brew installed python and pygame.

  2. Jason Marshall reporter

    @dsr 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!

  3. 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.

    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).

  4. Jason Marshall reporter

    fc-list output on Mac OS X 10.4.11 with X11 installed from the install discs. No other extra options (such as extra fonts) or extra programs installed.

  5. 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.

  6. 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.

  7. Jason Marshall reporter

    I like the way Tk handles font options. I am thinking that 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.

  8. 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>>

  9. René Dudfield
    • changed status to open

    There's been a few reports of this taking a long time on OSX. Need to consider this again based on further testing.

  10. Ben Bass

    Just done following to test an old pygame demo I had from a few years ago - this is on macOS Sierra (10.12.4):

    $ brew install sdl
    $ pip3 install --user pygame
    $ python3
    ... <HANGS FOR AGES - Ctrl-C>
      File "", line 34, in <module>
        sys_font = pygame.font.SysFont('monospace', 20)
      File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/", line 280, in SysFont
      File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/", line 230, in initsysfonts
        fonts = initsysfonts_darwin()
      File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/", line 146, in initsysfonts_darwin
        fonts = initsysfonts_unix("/usr/X11/bin/fc-list")
      File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/", line 167, in initsysfonts_unix
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/", line 952, in communicate
        stdout, stderr = self._communicate(input, endtime, timeout)
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/", line 1581, in _communicate
        ready =
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/", line 364, in select
        fd_event_list = self._poll.poll(timeout)
    $ time fc-list
    real    0m34.613s
    user    0m28.388s
    sys 0m3.365s

    The program did eventually run, but I had to leave it well over the 34s it lists here.

  11. Log in to comment