- edited description
Need to update system font lists in sysfont.py (2013)
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 (25)
-
-
-
assigned issue to
-
assigned issue to
-
Is this issue causing fc-list to hang by any chance? Using OS X 10.9, brew installed python and pygame.
-
@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!
-
- edited description
Added link to OS X 10.9 font list
-
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).
-
- attached mac_font_list_getter.py
-
- attached fonts10.4.11.txt
Fonts on Mac OS X 10.4.11. No extra options (such as X11 or extra fonts) or extra programs installed.
-
- attached fc-list10.4.11.txt
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.
-
- attached fonts10.3.9.txt
Fonts on Mac OS X 10.3.9. No extra options (such as X11 or extra fonts) or extra programs installed.
-
- attached fc-list10.3.9.txt
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.
-
- 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.
-
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.
-
- changed version to 1.9.2 (under development)
-
- changed milestone to 1.9.2 (next release)
-
- changed milestone to 1.9.2
-
- changed version to 1.9.2 (pre-release)
-
- changed status to closed
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>>
-
- 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.
-
-
assigned issue to
-
assigned issue to
-
- changed version to 1.9.2
-
- changed milestone to 1.9.x
-
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 race_game.py ... <HANGS FOR AGES - Ctrl-C> File "race_game.py", line 34, in <module> sys_font = pygame.font.SysFont('monospace', 20) File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/sysfont.py", line 280, in SysFont initsysfonts() File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/sysfont.py", line 230, in initsysfonts fonts = initsysfonts_darwin() File "/Users/ben/Library/Python/3.4/lib/python/site-packages/pygame/sysfont.py", 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/sysfont.py", line 167, in initsysfonts_unix close_fds=True).communicate() File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py", line 952, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py", line 1581, in _communicate ready = selector.select(timeout) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/selectors.py", line 364, in select fd_event_list = self._poll.poll(timeout) KeyboardInterrupt $ $ 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.
-
Yeah... I think we need to put the font lists back. 10.10 fonts: https://support.apple.com/en-us/HT206872
-
- changed status to closed
This has moved to github: https://github.com/pygame/pygame/issues/179
- Log in to comment