Bug 48222

Summary: Glyph corruption in evince with cairo 1.12
Product: poppler Reporter: Søren Sandmann Pedersen <soren.sandmann>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: chris, psychon
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Søren Sandmann Pedersen 2012-04-02 18:01:17 UTC
This PDF file:

http://white.stanford.edu/~brian/scielab/scielab3/scielab3.pdf

renders correctly in evince 2.32.0 with cairo 1.10. With cairo 1.12.0, the text is illegible.
Comment 1 Chris Wilson 2012-04-03 06:13:25 UTC
The culprit is a user-font with a garbage font metric:

font_scale=(0.120000x0.120000), ascent=1.000000, descent=0.000000, height=1.000000, max_x=1.000000, max_y=0.000000
Comment 2 Adrian Johnson 2012-04-08 02:27:54 UTC
The font metrics returned by poppler look correct to me. They are all similar to:

x_scale: 0.120000 y_scale: -0.120000  x_bearing: 4.000000  y_bearing: 0.000000  width: 79.000000  height: 85.000000  x_advance: 88.000000  y_advance: 0.000000

x_scale: 0.120000 y_scale: -0.120000  x_bearing: 6.000000  y_bearing: -2.000000  width: 52.000000  height: 86.000000  x_advance: 65.000000  y_advance: 0.000000

x_scale: 0.120000 y_scale: -0.120000  x_bearing: 5.000000  y_bearing: 0.000000  width: 68.000000  height: 82.000000  x_advance: 80.000000  y_advance: 0.000000

x_scale: 0.120000 y_scale: -0.120000  x_bearing: 4.000000  y_bearing: 0.000000  width: 76.000000  height: 81.000000  x_advance: 85.000000  y_advance: 0.000000

The problem also occurs with the PS output. I compared the PS output between 1.10.2 and 1.12.0. The fonts are all the same - same metrics, same image data. The difference is that in the page content there is a 1 point high clip before each show glyphs. eg

97 666 1 -1 re W n        <---- here
0 g
BT
0.12 0 0 -0.12 97.08 665.22 Tm
/f-0-0 1 Tf
<00>Tj
ET
Q q
113 666 8 -1 re W n         <---- here
0 g
BT
0.12 0 0 -0.12 112.32 665.22 Tm
/f-0-0 1 Tf
<0102>Tj
ET
Q q
138 666 26 -1 re W n    <---- here
0 g
BT
0.12 0 0 -0.12 137.88 665.22 Tm
/f-0-0 1 Tf
<03040005>Tj
ET


This is not present in the 1.10.2 PS output. When I remove these lines the file renders correctly.

git bisect tells me the offending cairo commit is:

commit b132fae5e843c329d1414d1a65b2e8d66b99852f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 14 21:19:54 2011 +0100

    clip: Rudimentary support for clip-polygon extraction

Poppler is not generating the clips before each showing glyph. So even if the clip boxes were the correct size they still should not appear in the PS output.
Comment 3 Chris Wilson 2012-04-08 02:39:32 UTC
However the metrics feed into cairo are incorrect. Check the user_font->init().

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.