[cairo] glyph caching bug

Keith Packard keithp at keithp.com
Mon Dec 27 01:46:31 PST 2004


I've noticed a bug somewhere in the cairo glyph caching code -- it's using 
the wrong glyphs at times, and most often with large glyphs.

Here's an example nickle program which reproduces the bug in my 
environment.  It spins "CAIRO" around at a scale of 100; at some 
rotations, various letters are mistakenly replaced with other letters or 
blanks.  Very disconcerting; you'll note that the code takes care to 
double buffer the results and should be completely smooth.

I haven't tried to debug this very far; it looks hard to find to me...

-keith

------

autoimport Cairo;

const real off_x = 160;
const real off_y = -30;

void main ()
{
    cairo_t cr = new (off_x * 2, off_x * 2);

    set_font (cr, "bitstream vera sans-100");
    for (real t = 0; true; t += 0.3)
    {
        twixt (disable (cr); enable (cr))
        {
            twixt (save (cr); restore (cr))
            {
                identity_matrix (cr);
                set_rgb_color (cr, 1, 1, 1);
                rectangle (cr, 0, 0, width(cr), height(cr));
                fill (cr);
            }
            twixt (save (cr); restore (cr))
            {
                translate (cr, off_x, off_x);
                rotate (cr, t * pi / 60);
                set_rgb_color (cr, 0, 0, 0);
                move_to (cr, -off_x, -off_y);
                show_text (cr, "CAIRO");
            }
        }
    }
}

if (dim(argv) > 0) main ();



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041227/a6aac327/attachment.pgp


More information about the cairo mailing list