[cairo] UserFont size issue (ImageSurface)

Ian Britten britten at caris.com
Mon Feb 9 10:20:58 PST 2009


Behdad Esfahbod wrote:

>> Strangely, in this case I'm now using for testing, the PNG glyphs seem
>> to be drawing much *bigger* ??  Grrr - There's some sort of interaction
>> going on here that I just don't see...

> It's all in your code.  Standard debugging techniques apply.  Print the font
> matrix and the ctm and compare.  Are they different?  Then check out why you
> are getting different points for the two cases.  The points are coming from
> your code.  Can't help with that.

Ok, I think I've largely got it figured out... (Sweet Mary that wasn't
fun :( )
You probably knew this, but it seems that Cairo uses different code
paths when rendering text to PDF vs PNG, making it rather difficult to
narrow down the difference.

In the end though, it seems that when rendering text to PNG, Cairo uses
the FT flag FT_LOAD_NO_SCALE, indicating that the driver should not
scale the glyph points before returning them.  Since we had never used
that flag anywhere ourselves, the 'slot load' callback of our custom
font driver wasn't set up to check for, nor obey, that flag.

Enhancing out driver accordingly seems to have fixed this problem.
[ Now, I wonder what other flags are used that we've overlooked... :P ]

Ian


More information about the cairo mailing list