[cairo] Drawing text with different glyph widths

Behdad Esfahbod behdad at behdad.org
Tue Sep 11 23:00:51 PDT 2007

On Tue, 2007-09-11 at 20:06 -0400, Jeff Muizelaar wrote:
> PDF documents often do not embed fonts, however they do include the
> glyph widths for the missing fonts. Currently, the poppler cairo backend
> ignores these widths and draws the text with the glyph widths of the
> substituted font. This often causes some very ugly rendering:
> https://bugs.freedesktop.org/show_bug.cgi?id=12304
> https://bugs.freedesktop.org/show_bug.cgi?id=11864
> To fix these we need to draw using the glyph widths specified in the pdf
> file. Does anyone have any suggestions for how to achieve this with
> cairo?

If you want to do the same hack as xpdf, just compare width of 'm' and
apply a scale in the X direction  in the font matrix.

The other approach would be to do that per glyph.  Have some say five
versions of each font: normal size, 10% condensed, 25% condensed, 10%
stretched, 25% stretched...  Or some other, dynamic, heuristic.

> -Jeff


"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