You can also just violate the object by giving it an extra attribute: f = pygame.font.Font(filename, size) f.new_attribute = size
I'm pretty sure any OO enthusiast would applaud this method. There is certainly nothing bad that can be said about my method. No sir. =D -Thiago On Tue, Jan 13, 2009 at 12:48 AM, James Paige <b...@hamsterrepublic.com> wrote: > Seems to me like this should work: > > class SizeFont(pygame.font.Font): > > def __init__(self, filename, size): > pygame.font.Font.__init__(self, filename, size) > self.size = size > > --- > James Paige > > On Mon, Jan 12, 2009 at 04:07:11PM -0600, Jake b wrote: >> Create a basic Font() wrapper. When you create the font, save the size. >> On Mon, Jan 12, 2009 at 2:02 AM, Luca <luca...@gmail.com> wrote: >> >> On Sun, Jan 11, 2009 at 10:36 PM, Noah Kantrowitz <n...@coderanger.net> >> wrote: >> >> >> As far as I know, there's no way to get the size of the font that >> way. >> >> What I do is name the font names in an intuitive way: >> >> Font12 = pygame.font.Font("....", 12) >> >> Font18 = pygame.font.Font("....", 18) >> >> Font36 = pygame.font.Font("....", 36) >> >> Thanks all, but in this way is impossible to get the size on an unknow >> font? I'm making a library for developer that need to know what is the >> font size that the developer can have choosen... >> >> -- >> -- luca >> >> -- >> Jake >