[cairo] (Grossly) Misplaced glyph(s) at certain font sizes

Behdad Esfahbod behdad at behdad.org
Fri May 23 17:05:53 PDT 2008


On Sat, 2008-05-03 at 17:15 -0400, Behdad Esfahbod wrote:
> On Sat, 2008-05-03 at 13:11 -0700, Vladimir Vukicevic wrote:
> > 
> > On May 3, 2008, at 9:10 AM, Behdad Esfahbod wrote:
> > >
> > >> This violates the condition required of the backends in commit
> > >> 5a9642c5746fd677aed35ce620ce90b1029b1a0c, where it states:
> > >
> > > Ugh, that's ugly.  Lemme think about it.
> > 
> > Given that this case is probably going to be relatively rare, the  
> > easiest thing to do might be to just handle UNSUPPORTED in  
> > emit_glyphs, and go back over glyphs that have already been processed
> > and convert the coordinates back.
> 
> Wouldn't work.  We may have already flush some chunks of text (if the
> entire text doesn't fit in one request), so we would need to somehow
> communicate to the caller that some of the glyphs are drawn.  If we do
> so, then upon detecting a large glyph, we can flush whatever we got so
> far and then remove them from the request.  We can shift back the
> remaining glyphs and adjust the glyph count for example.  Needs changing
> internal show_glyphs API to take a pointer to the glyph count though.

Fixed now:

commit db1b18232b6854d14a1ee45a31bc2508ef36bc1a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 23 19:04:13 2008 -0400

    [cairo-xlib] Fix max-request size calculations
    
    First, XMaxRequestSize returns number of 4-byte words.  So multiply by 4 is
    needed in all uses.  Next, XRenderAddGlyphs uses BIG-REQUEST extension if
    available, so when checking for glyph size overflow, we should use
    XExtendedMaxRequestSize() first.
    
    Also use the right format when calculating glyph size.
    
    These changes combined, push the biggest font size that can be uploaded to the
    server from under 200 to about 5000.
    
    See bug #4339 for history.

commit cf473f4a75ca0d3c815222287d7c144e72de5add
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 23 19:57:48 2008 -0400

    [cairo-xlib] Fix show_glyphs when failing to upload a glyph
    
    Originally reported here:
    http://lists.cairographics.org/archives/cairo/2008-May/014032.html
    and analyized later in the thread.
    
    Change (font and surface) backend show_glyphs() API to take a
    int *remaining_glyphs argument.  It's used to communicate to the caller,
    by way of setting remaining_glyphs and returning INT_STATUS_UNSUPPORTED,
    that some of the glyphs were shown but not the others.  The xlib backend
    now correctly uses this to handle failure to upload a glyph to the server.
    So the large-font test passes now.
    
    An alternative approach could be to add some public value for glyphs
    indices that are not shown.  -1 perhaps (the xlib backend already uses
    that value internally).  Then instead of remaining_glyphs, a backend
    could simply set glyph indices of glyphs shown to that -1 value.




> >      - Vlad
-- 
behdad
http://behdad.org/

"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