def __init__(self, filename=None, fontsize=None, charset=DEFAULT_CHARSET): assert type(fontsize)==int if filename==None: filename=DEFAULT_FONT[0] if fontsize==None: fontsize=DEFAULT_FONT[1] # lets create the image for the texture from the font self._font=lib.Font(filename, fontsize) self._font.RenderSet(charset=charset) # make the glyph size details for each character image,extents=self._font.Render() #image=tools.fromSDLImageToPILImage(image) #print "IMAGE",image image.save("temp.png") self.extents=extents # call constructor Texture.__init__(self,image=image,filename=filename) # create the alpha numeric tex list self.charset=charset self._metrics=self._font.metrics # in a font, the tex's store is a hash rather than a list (not frames) self.texchars=dict([ (ch,Tex(self,*extents[ch])) for ch in charset]) self.texframes=[Tex(self,0.0,0.0,1.0,1.0)]