[cairo] Slightly Off-Topic Font Question

Behdad Esfahbod behdad at behdad.org
Mon Jun 2 12:20:26 PDT 2008

Hi Jeremy,

You can find answers to your questions by following the links on this


In short, you should ask Pango to lay text out, then in your custom
renderer it's up to you to get either glyph paths or glyph bitmaps from
cairo and cache them in GL textures and finally render the text.


On Mon, 2008-06-02 at 14:45 -0400, Jeremy Moles wrote:
> 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. :)
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list