[cairo-bugs] [Bug 28145] cairo_font_face_finish()
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon May 17 11:08:32 PDT 2010
https://bugs.freedesktop.org/show_bug.cgi?id=28145
--- Comment #1 from Ian Britten <britten at caris.com> 2010-05-17 11:08:29 PDT ---
Just to clarify for anyone reading this:
I ran into this problem using a [cairomm] workflow similar to this:
// Do a bunch of sequential draws
for (int i=0; i<numDraws; ++i)
{
// Make a new surface+context
Cairo::RefPtr<Cairo::ImageSurface> surface =
Cairo::ImageSurface::create( ... );
Cairo::RefPtr<Cairo::Context> context =
Cairo::Context::create(surface);
// Make a new FT face
FT_Face *ftFace = FT_Open_Face( "/path/to/ttf" ... );
// Draw a bunch of different text using the same FT face
for (j=0; j<numText; ++j)
{
Cairo::RefPtr<Cairo::FontFace> cFace =
Cairo::FtFontFace::create(ftFace, FT_LOAD_NO_HINTING);
// set misc attributes, such as size, colour, etc.
// Draw some text
context.set_font_face(cFace);
context.show_glyphs( ... );
}
// Finish with the Cairo entities
surface->write_to_png( ... );
surface->finish();
context.clear(); // Discard
surface.clear(); // Discard
// Discard the (one) FT face we allocated
FT_Done_Face(ftFace);
}
This workflow fails to render the text if the pointer address of the
FT_Face matches that of one used (and freed) during a previous iteration.
As alluded to by Chris, the crux of the problem seems to be Cairo using
a single static cache of FT_Face objects, without accounting for the
possibility that the face has been freed, then another one allocated
with the same pointer address.
[ Maybe the cache should be on the Surface/Context, rather than global,
and thus cleaned up with each Surface/Context? Just a thought ... ]
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the cairo-bugs
mailing list