Re: [pygame] Pygame font issues
On Sunday 03 May 2009, René Dudfield wrote: heh, I guess not. It'd be good to report to slackware. Please let me know if you do... otherwise I'll report the bug. Its not an official slackware package. I've reported it to its source, slacky.eu, a large established repository run by Italian slackers. -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
ah. the problem stems from the pygame 1.8.1release source tar ball... which has some incorrect permissions in it. Will make sure that's fixed in 1.9. On Tue, May 5, 2009 at 4:25 AM, Peter Chant p...@petezilla.co.uk wrote: On Sunday 03 May 2009, René Dudfield wrote: heh, I guess not. It'd be good to report to slackware. Please let me know if you do... otherwise I'll report the bug. Its not an official slackware package. I've reported it to its source, slacky.eu, a large established repository run by Italian slackers. -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
On Sunday 03 May 2009, René Dudfield wrote: hi, what are the permissions of the font file? Maybe something weird is going on there? Bingo. the default font was set to 700, set it to 644 and it worked. Sounds like a pygame installation issue, but then if it is surely someone else would have spotted it by now? Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
heh, I guess not. It'd be good to report to slackware. Please let me know if you do... otherwise I'll report the bug. On Sun, May 3, 2009 at 6:45 PM, Peter Chant p...@petezilla.co.uk wrote: On Sunday 03 May 2009, René Dudfield wrote: hi, what are the permissions of the font file? Maybe something weird is going on there? Bingo. the default font was set to 700, set it to 644 and it worked. Sounds like a pygame installation issue, but then if it is surely someone else would have spotted it by now? Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
On Friday 01 May 2009, Jake b wrote: 1) Are you using py2exe? No. 2) Copy-ing the font to the same folder as the game will probably work. Unfortuately it did not. 3) I ripped out my font name matching code, it might help. [It might be easier if you want the whole font wrapper class.] Thanks. I'm not sure that it does. You've created a wrapper, which does some useful checking, but at the end of the day it still appears to make a simple call with a font name. font = pygame.font.Font(None, 36) #font = pygame.font.Font('liberationserif',36) I suspect it is a path problem, but I'm new to python and am not really sure how to fix it. In fact, I have just found that if I pass the file path it does not throw an error. Unfortunately I still have not got test displayed for other reasons I am just learning. However, it is a sunny day so perhaps I ought to take advantage of it. Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
does font = pygame.font.Font(None, 36) use the player's default system font? --- On Sat, 5/2/09, Peter Chant p...@petezilla.co.uk wrote: From: Peter Chant p...@petezilla.co.uk Subject: Re: [pygame] Pygame font issues To: pygame-users@seul.org Date: Saturday, May 2, 2009, 5:12 AM -Inline Attachment Follows- On Friday 01 May 2009, Jake b wrote: 1) Are you using py2exe? No. 2) Copy-ing the font to the same folder as the game will probably work. Unfortuately it did not. 3) I ripped out my font name matching code, it might help. [It might be easier if you want the whole font wrapper class.] Thanks. I'm not sure that it does. You've created a wrapper, which does some useful checking, but at the end of the day it still appears to make a simple call with a font name. font = pygame.font.Font(None, 36) #font = pygame.font.Font('liberationserif',36) I suspect it is a path problem, but I'm new to python and am not really sure how to fix it. In fact, I have just found that if I pass the file path it does not throw an error. Unfortunately I still have not got test displayed for other reasons I am just learning. However, it is a sunny day so perhaps I ought to take advantage of it. Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
On Saturday 02 May 2009, Yanom Mobis wrote: does font = pygame.font.Font(None, 36) use the player's default system font? None does not work: self.font = pygame.font.Font(None,36) RuntimeError: default font not found 'freesansbold.ttf' its looking for freesansbold, which even though it exists, can't be found: bash-3.1$ locate freesansbold.ttf /usr/lib/python2.5/site-packages/pygame/freesansbold.ttf Note, I think your reference to default systems font is a windows reference. I'm on linux. Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
hi, what are the permissions of the font file? Maybe something weird is going on there? cu, On Sun, May 3, 2009 at 3:14 AM, Peter Chant p...@petezilla.co.uk wrote: On Saturday 02 May 2009, Yanom Mobis wrote: does font = pygame.font.Font(None, 36) use the player's default system font? None does not work: self.font = pygame.font.Font(None,36) RuntimeError: default font not found 'freesansbold.ttf' its looking for freesansbold, which even though it exists, can't be found: bash-3.1$ locate freesansbold.ttf /usr/lib/python2.5/site-packages/pygame/freesansbold.ttf Note, I think your reference to default systems font is a windows reference. I'm on linux. Pete -- Peter Chant http://www.petezilla.co.uk
Re: [pygame] Pygame font issues
1) Are you using py2exe? 2) Copy-ing the font to the same folder as the game will probably work. 3) I ripped out my font name matching code, it might help. [It might be easier if you want the whole font wrapper class.] class Text(object): ...code... def __init__(self, text=None, font=None, size=18,color=black, bold=False, italic=False): font can be: 1) filepath: ttf/arial.ttf 2) list of names to search: ( calls self.match_font(list) ) arial, verdana, freesans 3) None use default font self.screen = pygame.display.get_surface() self.font_name = font self.font_size = size self.color = pygame.color.Color( color ) self.text = text self.antialias = True self.color_bg = None self.rect = pygame.Rect(15,15,0,0) self.match_font('bitstreamverasans, verdana, arial,lucidia console') self._create_font() def match_font(self, font_list, bold=False, italic=False): pygame.font.match_font() wrapper, but also sets the font. You can call with a commma deliminated list. It chooses the first valid font. filename = pygame.font.match_font(font_list, bold, italic) if not filename: # if failed, fallback on one that works filename = pygame.font.match_font('bitstreamverasans, verdana, arial,lucidia console,freesans, freesansbold') # should at least have freesans[bold] since it comes with pygame if( filename ): self.font_name = filename #was: font_list self._create_font() def _create_font(self, font=None): create Font() object try: self.font = pygame.font.Font( self.font_name, self.font_size ) except IOError: if font: self.match_font(font) #, bold, italic) -- Jake