Bug 6019

Summary: RenderAddGlyphs fails with BadLength
Product: cairo Reporter: Chia-I Wu <b90201047>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high CC: abelcheung
Version: 1.1.1   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: mixed outline/bitmap glyphs

Description Chia-I Wu 2006-02-24 05:35:12 UTC
Hi,

cairo uses the same GlyphSet to render all glyphs of a scaled font (see
`_cairo_xlib_surface_add_glyph' in cairo-xlib-surface.c.  As a GlyphSet requires
all glyphs to be of the same PictFormat, this can cause problems with
bitmap/outline mixed fonts.

For example, the most widely used traditional Chinese font, AR PL New Sung[1],
has mixed bitmap/outline glyphs at size 15px.  When try to render glyphs of that
size, cairo fails with the following error message:

X Error of failed request:  BadLength (poly request too large or internal Xlib
length error)
  Major opcode of failed request:  157 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  24
  Current serial number in output stream:  29

[1]: http://cle.linux.org.tw/fonts/FireFly/fireflysung-1.3.0.tar.gz
Comment 1 Chia-I Wu 2006-02-24 05:38:21 UTC
Created attachment 4737 [details]
mixed outline/bitmap glyphs

The uppercase roman numbers are bitmaps (depth=1) and the lowercase ones are
outlines (depth=8, anti-aliased)
Comment 2 Chia-I Wu 2006-02-25 21:20:34 UTC
In Xft, those outlines are rendered with anti-alias off.  All glyphs, bitmaps or
outlines, are thus of format PictStandardA1 and everything works well.  
Actually, I do turn anti-alias off in fontconfig's config file (so that the
embeded bitmaps are used when available).

<match target="font">                                                          
                                             
        <test qual="any" name="family" compare="eq">                           
                                             
                        <string>AR PL New Sung</string>                        
                                             
        </test>                                                                
                                             
        <test name="pixelsize" compare="less_eq">                              
                                             
                <double>16.5</double>                                          
                                             
        </test>                                                                
                                             
        <edit name="antialias" mode="assign">                                  
                                             
                <bool>False</bool>                                             
                                             
        </edit>                                                                
                                             
</match>                                                                       
                                             

Don't know why cairo still renders outlines with anti-alias.
Comment 3 Chris Wilson 2008-04-07 07:34:49 UTC
I believe this to be fixed by, in particular, commit 805b668260c47e6d3d854361fcc53f12bd2a57e1 and the work to resolved bug 13479.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.