[cairo] Cairo vs. Xft glyph rendering

Daniel Amelang daniel.amelang at gmail.com
Mon Dec 11 14:08:27 PST 2006


On 12/11/06, Behdad Esfahbod <behdad at behdad.org> wrote:
> On Fri, 2006-12-08 at 10:04 -0500, Vladimir Vukicevic wrote:
>
> > Maybe one of the X folks here could let us know whether doing this could
> > result in a performance gain?  We already have to do the lookup per
> > glyph to make sure that it's sent to the server, so we could always
> > change the data structure that's used to pass things down to
> > xlib_show_glyphs{8,16,32} so that it sends the right info, instead of
> > just sending down the cairo_glyph_t array.  That is, either pass down
> > cairo_glyph_t + per-glyph offsets, or even do the run computation ahead
> > of time and pass down some structure that can be trivially converted to
> > the appropriate size XGlyphElt array.
>
> This is basically what I've done now, and pushed into my tree under the
> branch xlib-show-glyphs-fast:
>
> http://gitweb.freedesktop.org/?p=users/behdad/cairo.git;a=shortlog;h=xlib-show-glyphs-fast

It looks really good to me. The way you merged the show8/16/32
functions is a little scary (I wasn't aware that the various Elt*
structures were binary compatible, but now I do!), but without
something like a c++ template function, it's probably the best we can
get. I think you did great under the circumstances.

I see this quite a bit in various corners of cairo (and in your latest patch):

glyph.index = (unsigned long) -1;

Would it be safer/more readable to define something like
CAIRO_GLYPH_INDEX_SKIP in cairoint.h?

Also, I see a lot of stuff like this that makes me wonder if some
additional #defines could make the code more understandable:

> width = max_index < 256 ? 1 : max_index < 65536 ? 2 : 4;

Anyway, congratulations for amazing us once again with some great work!

Dan


More information about the cairo mailing list