[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] freetype + unusual font format: What am I doing wrong?
I looked at the BDF code in freetype2, and then ran a debugger on
pygame.freetype to confirm. In freetype2, when only a "SIZE" record in a
BDF file, the width, in pixels-per-em, is calculated as (height * 2 / 3)
, which may not be the point size given in the "SIZE" record. For
c64.dbf this is (8 * 2 / 3) = 5. The width is used as the font size.
This is a quirk of the freetype library. I see no easy work-around.
 bdfdrivr.c:438, see
On 13-10-06 02:44 PM, Lenard Lindstrom wrote:
Okay, setting the resolution to 45 corrects the sizes:
I don't know why this is the case. Explicit bitmap font support is not
built into the freetype module, so is untested. It is something I
intended, but have not got around too. Sorry.
On 13-10-05 03:07 PM, Lenard Lindstrom wrote:
The freetype version of pygame.font.init() is just
pygame.freetype.init(). It takes a 'resolution' keyword argument that
sets the default pitch used in rendering. I suppose setting the pitch
to the screen resolution, in pixels per inch, makes the point size
equal pixel size. The pygame.freetype.Font type allows pitch to be
set individually for each Font instance. It is this pitch twiddling
which allows pygame.freetype.Font to mimic how pygame.font.Font
handles the default Pygame font, which is scaled differently from
On 13-10-05 01:48 PM, Jason Marshall wrote:
Maybe my understanding of size is wrong...
*From:* Jason Marshall <jmm0@xxxxxxxxx>
*To:* "pygame-users@xxxxxxxx" <pygame-users@xxxxxxxx>
*Sent:* Saturday, October 5, 2013 2:41 PM
*Subject:* Re: [pygame] freetype + unusual font format: What am I
Sorry, updating to pygame-1.9.2a0-12de2da43ecb.win32-py3.3.msi
By passing a different (wrong) size, I was able to get freetype to
render some fonts but not others. I made a webpage with the only
documentation that I have found, some demo code that can render from
some BDF fonts, and a screenshot:
I suspect that there's a mistake in the documentation for
instantiating the pygame.freetype.Font class. If I follow the
documentation and pass it the font name, style and size, I get an
error. If I just pass only the font name and a certain (wrong)
size, it sometimes renders.