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