[cairo] xlib backend mis-draws fonts with partial bitmap strike

Behdad Esfahbod behdad at behdad.org
Sun Dec 16 22:23:30 PST 2007


I committed a mixture of your patch and mine, and reverted Keith's
commit.  I took your idea of using a fixed-size array of glyphsets (I
was thinking about linked-lists...), but redid it with all the new
show-glyphs stuff in xlib backend.  The end result is no less efficient
that what it used to be, so that's good.

commit 83963d2a9ec445e23cfbe692b877177a9d9d135e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 17 01:19:53 2007 -0500

    [cairo-ft] Revert "Force non-AA text when using a bitmap strike with only scaling transform." (#13479)
    
    The reasoning for that commit was that fonts with bitmap strikes should be
    rendered with antialiasing off for those (hopefully) few glyphs that don't
    have a bitmap.
    
    However, it turns out, there are fonts that have some, but very few, bitmaps,
    and this changed forces non-AA rendering on them.  We now support multiple
    glyph formats per font in the Xlib backend, so backing this out to let every
    glyph render as is.  Fontconfig rules can be used to force AA off on a per-font
    basis.
    
    This reverts commit 06af5c2891b89da28581c30afcde06c5442884db.

commit 805b668260c47e6d3d854361fcc53f12bd2a57e1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Dec 17 01:14:27 2007 -0500

    [cairo-xlib] Support scale fonts with glyphs of multiple formats (#13479)
    
    We maintain three Xrender glyphsets per scaled font, one for each of A1, A8,
    and ARGB32.  This is required to correctly support fonts with bitmaps for
    some glyphs but not all.



After someone tests and confirms that this fixes the original issue
Keith was trying to fix, I'll go ahead and backport it.  Keith, can you
try it?


behdad


On Wed, 2007-12-12 at 21:37 -0500, Luo Jinghua wrote:
> 
> 
> On Oct 30, 2007 3:05 PM, Keith Packard <keithp at keithp.com> wrote:
>         Sazanami Mincho is a Japanese font which offers several bitmap
>         strikes,
>         however coverage of those strikes is not complete. If the
>         first glyph
>         has a bitmap version, cairo assumes that all of the glyphs
>         will and
>         creates the font in A1 format. However, glyphs which do not
>         have bitmap 
>         strikes will get mis-rendered as they are first drawn to an A8
>         image and
>         then poorly copied to A1. However, if the first glyph does not
>         have a
>         bitmap strike, it will be drawn anti-aliased, and all of the
>         remaining 
>         glyphs will end up getting copied to an A8 surface.
>         
>         It seems like we have three options:
>         
>          1) Identify bitmap strike sizes and draw all glyphs as A1
>         surfaces.
>          2) Draw bitmap glyphs as bitmaps and other glyphs as A8
>         surfaces. 
>          3) Identify whether a bitmap strike is complete and if not,
>         create
>            all glyphs as A8 glyphs in case a non-bitmap glyph is
>         requested.
>         
>         The first would require that we discover bitmap strikes in the
>         FreeType 
>         backend and turn off the antialias flag. I think this is
>         fairly simple
>         to do.
>         
>         The second would require splitting the font into two objects;
>         XRender
>         glyphsets can only be in a single format. This seems like
>         slightly more 
>         work, but certainly not impossible.
>         
> I implemented option 2 in 2006, but was rejected due to its
> 'complexity'。I attach my old patch here,
> obviously, it will not be applied any more, that file has been changed
> a lot :). 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
behdad
http://behdad.org/

...very few phenomena can pull someone out of Deep Hack Mode, with two
noted exceptions: being struck by lightning, or worse, your *computer*
being struck by lightning.  -- Matt Welsh



More information about the cairo mailing list