[cairo] Text rendering questions

Ian Britten britten at caris.com
Wed Oct 29 11:19:15 PDT 2008

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?

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.

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 ]

More information about the cairo mailing list