[cairo] Text rendering questions

Ian Britten britten at caris.com
Thu Nov 6 06:19:50 PST 2008


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...

(*) 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.

> 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...

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



More information about the cairo mailing list