[cairo] Cairo/FreeType integration [Advanced]

Behdad Esfahbod behdad at behdad.org
Thu Oct 9 17:24:47 PDT 2008


Ian Britten wrote:
> Behdad Esfahbod wrote:
> 
>>> At the point I'm trying to integrate Cairo into all this, I
>>> basically have an FT_Face, an FT_Glyph, (X,Y) position, angle, etc,
>>> I'm just not sure if I can make use of all that, with the existing
>>> (public) interfaces from Cairo.  For example, when looking at
>>> http://www.cairographics.org/manual/cairo-FreeType-Fonts.html, I
>>> don't see any way to work with an existing FT_Glyph...
>> Cairo's FreeType integration is at the level of FT_Face and glyph indices.  No
>> FT_Glyph involved.
> 
> Right.  I'm just concerned about a couple of issues, mostly about how
> Cairo is obtaining the actual FT_Glyphs
> 
> - Are you doing your own lookup/caching?  We already do this (Using
>    the FT ImageCache), and I was thinking that it wouldn't be necessary
>    for Cairo to do it too (in our case).
>    Admittedly, it might just end up being some extra RAM/CPU overhead,
>    but I wasn't sure if I could bypass it and patch in at a lower
>    level.

We do our own caching, yes, mostly in your X server, so there's a huge difference.

> - How do you obtain the actual FT_Glyph?  I'm concerned that you may
>    not be able to get Glyphs for some of our Faces, since we use a
>    customized FL_Library that contains extra drivers (To support
>    proprietary font formats).
>    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.

> Anyways, I'll start by trying to use the existing interfaces, and
> see where I get.  I'm only asking about this stuff (Before trying it)
> to hopefully avoid wasting my time by heading down the wrong path...
> 
>> If you need metrics, use cairo API for that too.
> 
> Thanks anyway, but as I mentioned earlier, we already have an
> extensive framework built on ICU and FreeType to handle all that.
> I only need to push stuff to Cairo - I don't think I need to ask
> Cairo for any information.

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.

behdad

> As always, many thanks for any info, suggestions, etc!
> Ian
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
> 


More information about the cairo mailing list