[cairo] cairo backend for xpdf - first drop

Carl Worth cworth at redhat.com
Wed Dec 22 07:39:07 PST 2004


On Wed, 22 Dec 2004 09:08:29 +0100, Alexander Larsson wrote:
> On Tue, 2004-12-21 at 16:40 -0500, Carl Worth wrote:
> >
> > Do you generally still have word structure available in PDF files? Or
> > is every glyph already placed individually?
> 
> PDF documents are basically pre-layouted. You aren't really supposed to
> modify the positioning of the glyphs.

While it's true that we're not supposed to modify the positioning, the
fact is that we can't avoid this entirely since we have limited
precision in our output display devices. So the question becomes how
can those pixels best be used to represent the document.

Consider the two attached images, both captured from xpdf rendering
the same document (PLRM.pdf). The text_unhinted image is from xpdf
3.00, while the text_hinted image is from xpdf with the cairo
patches. Both versions link to freetype, so I assume the major
difference between the two is that cairo asks freetype to do hinting.

In text_unhinted, the glyphs appear well-positioned, but blurry.

In text_hinted, the individual glyph shapes appear much more crisp and
pleasing. But the positioning now appears wrong. The "an" and "ai"
sequences are far too crowded, while there is excessive space among
the "nd" and "id" sequences. The hinting process has moved some glyph
elements slightly, and in some cases these errors add up to bad
results. Notice that the stem of the 'i' moved slightly to the left
while the curve of the 'd' moved to the right.

The net result is that in the case of "aid", after hinting there is
now sufficient room to move the 'i' one pixel to the right. That would
improve the appearance dramatically.

I don't think it would be inappropriate to make this kind of
adjustment, (as it is meant to compensate for error already introduced
by the hinting). This sort of adjustment could easily be limited to
single-pixel adjustments of glyphs within a word I think.

The question I had is whether xpdf has all the information it needs to
be able to compute this adjustment. The answer may be "it depends on
the document", but I would certainly like to see this happen when
possible.

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_unhinted.png
Type: image/png
Size: 1082 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041222/031526b1/text_unhinted.png
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_hinted.png
Type: image/png
Size: 1214 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041222/031526b1/text_hinted.png


More information about the cairo mailing list