[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] Integrating FreeType and Cairo

From: Ian Britten
Subject: [ft-devel] Integrating FreeType and Cairo
Date: Mon, 20 Oct 2008 12:48:38 -0300
User-agent: Thunderbird (X11/20080926)

Hi all,
I'm trying to integrate Cairo support into our existing FreeType-using
framework, and have hit a (fatal?) blocker that I wanted to bounce off
the FT community/maintainers, to see if they had any solution...
[ NB - I'm also discussing it with the Cairo developers too... ]

Basically, at the point of integration, I have a FT_Face that I'm
looking to draw a specific glyph with.  Cairo fortunately provides a
FT hook for this:

Unfortunately, it's not that simple (in our case).
- First, the FT_Face that I have came from the FT cache (Specifically
  from FTC_Manager_Lookup_Size().
- Second, Cairo doesn't seem to use+discard the given FT_Face
  immediately, but instead just hangs on to it, and uses it later,
  when drawing/flushing everything out.

[ I'm sure many of you can already see the problem... :( ]
What seems to be happening is that the FT cache frees up the FT_Face
structures as part of its normal operation (as we draw all of our
text, which would use many different FT_Face objects).  This leaves
the FT_Face pointer down inside Cairo 'dangling', causing a subsequent
crash when it's eventually used by Cairo.

As I'm sure you can imagine, I'm not really eager to rip out our use
of the FT cache just to add Cairo support to our framework.

I was thinking about trying to add another (Cairo-specific) cache at
my level (to cache the FT_Face objects I pass to Cairo), but I
couldn't see an equivalent to FT_Face_Copy(), and wasn't sure if I
could safely write one, via the public interfaces.

Has anyone run into a case/workflow like this before?  Does anyone
have any ideas for a possible solution?

Many thanks for any suggestions/information!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]