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

Re: [pygame] How the get a font size



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 <lucafbb@xxxxxxxxx> wrote:
> 
>      On Sun, Jan 11, 2009 at 10:36 PM, Noah Kantrowitz <noah@xxxxxxxxxxxxxx>
>      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