[cairo] Slightly Off-Topic Font Question

Jeremy Moles jeremy at emperorlinux.com
Mon Jun 2 11:45:22 PDT 2008


Hello all! This seems like a great place to ask this question, though it
does feel somewhat off-topic since it probably has more to do with Pango
than it does Cairo. I'm hoping Bedhad or someone else can chime in and
just give me a few, quick pointers.

I'm writing a small GUI toolkit using OpenGL & Cairo for use in the
creation of widgets, windows, and other assorted (but simple) graphical
control elements. Naturally, font support is a big part of any such
beast. The toolkit in question (OpenSceneGraph) has a native module for
supporting Freetype, but the quality I'm getting is, unfortunately,
nothing short of abysmal. There are probably a number of reasons for
this (such as the need to provide an arbitrary API for the both 2D and
3D placement), but the code is far too complicated for me to modify, so
I've begun to search for an alternative.

My main inspiration comes from things like the Source engine (Half-Life,
etc.) which have extremely pristine, sharp fonts in their interfaces. I
know it's possible to do, but I don't think I know enough about font
rendering in general to understand what components need to be in place
to begin tackling this problem.

Basically, what I'm looking for is a way to achieve the highest font
quality possible in an OpenGL game engine, preferably using Cairo--but
Pango directly, if necessary.

- Can I use Cairo for this, or should I being learning the Pango API
instead? 

- In either case, would it be possible (or straightforward) to
pre-render--or render on demand--a glyph (is this the right word?) into
it's own rectangular textured quad for use later?

- Most importantly though, what things must be in place to achieve the
highest amount of font clarity? I assume this means I want full hinting,
but that may require rendering the fonts on top of the existing OpenGL
back buffer, which isn't really an option.

Thanks before hand for any advice anyone might have. :)



More information about the cairo mailing list