[cairo] Text rendering questions

Behdad Esfahbod behdad at behdad.org
Thu Nov 6 09:25:25 PST 2008

Ian Britten wrote:
> Behdad Esfahbod wrote:
> [ snip ]
>> Without further knowing how you are modifying the FT_Face, I'm out of ideas.
> Modifying?
> Sorry if I haven't been clear, or have misunderstood you, but I'm not
> really "modifying" anything, or really doing anything too unusual (as
> far as I can tell)
> To re-summarize:
> - I obtain a FT_Face  (*)
> - I wrap it in a Cairo face (via cairo_ft_font_face_create_for_ft_face())
> - I set that on my context (via set_font_face())
> - Set the remaining attributes (set_font_matrix(), set_source_rgba())
> - Draw the requested glyph at the requested position (via
>    show_glyphs())
> Other than modifying my Context to draw, I'm just 'pushing' stuff to
> Cairo.  I don't 'get' anything from Cairo - Certainly not a FT_Face,
> if that's what you were thinking...

I thought you said you pass the same FT_Face to cairo multiple times?  If yes,
then how is that useful?

> (*) The FT_Face originates from FT_Open_Face, in our own code.  I
> simply hang on to it until my Cairo objects are cleaned up.  Because
> they're being cached, sometimes the FT_Face passed to Cairo may be
> the same (pointer) as a previously-used one.  It is never modified
> by me though.
>> The PDF, all the font-subset files, ...  You really don't want to dig in there!
> No, no I don't...  :(
> However, given that it /seems/ like I'm (just) getting the wrong
> font attributes (Bold, Italic, etc), you don't think that that may
> be something specific to the PDF font handling?  The actual face
> type (eg: Arial) seems to always be correct.

It's quite possible, but how can we fix it if we are only guessworking here?

>> Maybe try to reproduce your problem with the image backend?
> I plan to eventually get to support other Cairo backends, but at the
> moment, I may be somewhat restricted to PDF, due to assumptions/etc
> in my initial implementation.  I'll see what I can do though...

It's a two line patch.


> As always, may thanks for any help/info/suggestions!
> Ian

More information about the cairo mailing list