[cairo] Text rendering questions

Behdad Esfahbod behdad at behdad.org
Thu Oct 30 01:31:57 PDT 2008

Ian Britten wrote:
> Ian Britten wrote:
>> In all cases, I'm rendering one glyph at a time, using a FT_Face
>> and a defined position+size.
> [ snip ]
>> The two main problems I'm seeing at the moment are:
>    [ snip ]
>> - Sometimes, the wrong font is being used (Italic, Bold, etc)
> [ snip ]
>> What should I expect regarding the specified (FT) font?  Should it
>> always be used?  When my Regular text is drawn using an Italic
>> font, or my Bold text is drawn using a Regular font (And it's very
>> intermittent/inconsistent), I'm left scratching my head...
> I'm starting to think that this problem might be related to the
> FT_Face handling I'm doing...  (As discussed in previous messages)
> So, what happens if I make multiple cairo_font_face_t objects,
> using the same FT_Face instance for each of them (Via
> cairo_ft_font_face_create_for_ft_face())?  Should it work as
> expected, with each cairo_font_face_t being independent of each
> other (Even if they're sharing the same FT_Face instance)?  Or
> will they be interconnected, possibly messing up each other?

With 1.8.x, I think if you create from the same FT_Face, you should get the
same cairo_font_face_t back.

> If I make a new FT_Face for each piece of text I'm rendering,
> then it *seems* that I'm getting the correct fonts in my output.
> However, if I try to cache the FT_Face instances, and share/reuse
> them between multiple cairo_font_face_t objects, then I seem to
> be intermittently getting the wrong font, as described.

All I can suggest is that you check with 1.8.0 and if the problem resists,
come back and we'll try to debug it.

> Unfortunately, simply allocating (And managing) a new FT_Face
> each time I need to render a glyph to Cairo is not possible,
> since FreeType seems to have a limit on the number of FT_Face
> objects I can create simultaneously.  After creating about
> 11,000 FT_Face objects (Via FT_Open_Face()), I start getting
> errors from FT, and can't create any more.  This prevents me
> from rendering even a basic set of our data...  :(
> Does any of this help illuminate what might be going wrong?
> [ My size problem remains, and seems unchanged by any of this ]

No idea about the size.  Maybe you are using bitmap fonts?

> Ian


More information about the cairo mailing list