[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] BUG: Pygame hangs when finding system font



On Wed, Apr 05, 2006 at 02:55:06PM -0700, evilmrhenry wrote:
> x86, Linux, Debian, Testing.
> Python 2.3.5 and 2.4.2
> Pygame 1.7.1
> 
> 
> Code:
> import pygame
> pygame.init()
> pygame.font.init()
> pygame.font.SysFont('Arial', 50, bold=True)
> 
> 
> The last line hangs forever on my machine. Ctrl-C gives:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.3/site-packages/pygame/sysfont.py", line 271, 
> in SysFont
>     fontname = styles.get((bold, italic))
> KeyboardInterrupt
> 
> It's not always that line, but always within the while loop that 
> encloses that line.
> 
> 
> pygame.font.get_fonts() returns
> ['bitstreamverasans', 'wasy10', 'bitstreamverasansmono', 'msbm10', 
> 'msam10', 'opensymbol', 'cmsy10', 'cmr10', 'bitstreamveraserif', 
> 'cmmi10', 'cmex10']
> 
> 
> 
> The following lines *do* work:
> pygame.font.SysFont('test', 50, bold=True)
> pygame.font.SysFont('Arial', 50)
> 

Arial is a bad choice for default font if you plan to support GNU/linux. 
Arial is non-free, so it will rarely be installed. Your Debian box will 
not have Arial unless you apt-get the msttcorefonts package from 
the contrib repository

But that does not explain why it is hanging. Attempting to load a 
non-existant font should do something more reasonable than hanging :)

---
James Paige