[cairo] Cairo/FreeType integration [Advanced]

Behdad Esfahbod behdad at behdad.org
Fri Oct 10 17:10:20 PDT 2008


Ian Britten wrote:
> Behdad Esfahbod wrote:
>>>    I'm uncertain if the FT_Face I give you connects back to our
>>>    FT_Library (and driver), or if you'll end up using your own
>>>    instance (without our driver), meaning you'd be unable to get the
>>>    correct FT_Glyph.
>> If you provide cairo with your FT_Face, we use the library from that.
>> Simply use cairo_ft_font_face_create_for_ft_face() and it should all
>> work.
> 
> Phew!  Many thanks for confirming this!  I hadn't traced through the
> various FT data structures to determine this.
> On to coding then...   :)

I searched in cairo-ft-font.c for "library" and it wasn't more than 30 seconds
to verify.

>> Right, but a FreeType+ICU combo need not do any rasterization to begin
>> with.  You can do all your shaping with ICU and feed cairo with glyph
>> indices.  It would be better if you ask cairo for glyph metrics, but
>> that's not a huge deal.
> 
> Hmmm... That's twice you've mentioned that now, so I guess I should
> maybe pursue this point a bit more...
> [ I'm sure you can understand my hesitation to disturb our existing,
> stable, tested solution, without knowing *why* ... ]

I understand.  However, I'm more in favor of doing some more work to get to a
system I understand how works other than letting it work until it breaks.
Cause having your code and cairo code separately compute extents for glyphs,
given all gazillion different options/flags FreeType accepts, is sure going to
result in surprises (badly kerned glyphs, etc) sooner or later.

Cheers,

behdad

> So, why would it be "better" to use Cairo for glyph metrics?
> Accuracy?  Performance?  Other?
> 
> As always, thanks for any information. (And your patience! :) )
> Ian



More information about the cairo mailing list