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

Behdad Esfahbod behdad at behdad.org
Tue Oct 30 09:54:36 PDT 2007

On Tue, 2007-10-30 at 03:05 -0400, Keith Packard 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.

Heh, so this finally came up.  I'm fine with the second option.  It's
the right fix and not as hard as it sounds first.  We don't need to use
different glyph spaces even.  And the per-glyph glyphset can be stored
in scaled_glyph->surface_private that we don't really use currently.

Anyone taking this?

> The third seems crazy; eliminating all benefit of bitmap strikes for at
> least this font.


"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