After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750569 - Markup annotations of subtype Underline are drawn ABOVE the marked text
Markup annotations of subtype Underline are drawn ABOVE the marked text
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: pdf annotations
git master
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-08 14:51 UTC by Philipp Reinkemeier
Modified: 2015-06-13 07:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PDF with underline markup drawn incorrectly (2.98 KB, application/pdf)
2015-06-08 14:51 UTC, Philipp Reinkemeier
  Details
pdf: Fixed wrong order of QuadPoints in get_quads_for_area. (1.08 KB, patch)
2015-06-08 15:14 UTC, Philipp Reinkemeier
committed Details | Review

Description Philipp Reinkemeier 2015-06-08 14:51:51 UTC
Created attachment 304780 [details]
PDF with underline markup drawn incorrectly

When adding a markup annotation of subtype Underline, the line is drawn ABOVE the marked text.

Steps to reproduce:
1. Create a highlight annotation.
2. Change markup type to Underline
3. Observe the described effect.

I attached an uncompressed PDF showing this effect. The text i marked ranges from ... "to test pdf annotation features" ... to ... "can have 4 subtypes"
Comment 1 Philipp Reinkemeier 2015-06-08 15:14:16 UTC
Created attachment 304786 [details] [review]
pdf: Fixed wrong order of QuadPoints in get_quads_for_area.

The problem is in the function get_quads_for_area.

Actually, the real problem is that virtually all PDF readers do NOT follow the PDF specification with respect to the order of the points of quadrilaterals. the spec says:
"Each quadrilateral shall encompasses a word or group of contiguous words in the text underlying the annotation. The coordinates for each quadrilateral shall be given in the order x1 y1 x2 y2 x3 y3 x4 y4 specifying the quadrilateral’s four vertices in counterclockwise order. The text shall be oriented with respect to the edge connecting points (x1, y1) and (x2, y2)."

However, what acrobat reader implements and the poppler library expects for rendering is different:
Say you have this rectangle
(x1,y1) ----- (x2,y2)
   |             |
   |             |
   |             |
(x3,y3) ----- (x4,y4)

Then the expected order is x1 y1 x2 y2 x3 y3 x4 y4.
Currently, the order produced by evince is x3 y3 x4 y4 x1 y1 x2 y2.

The attached small patch fixes this issue.

Btw: This also makes text markup annotations with subtype highlight look better in evince and acrobat reader. Without this patch acrobat reader renders some strange concave shape. With the patch the shape has nice rounded corners as expected.
Comment 2 Carlos Garcia Campos 2015-06-13 07:32:48 UTC
Comment on attachment 304786 [details] [review]
pdf: Fixed wrong order of QuadPoints in get_quads_for_area.

Excellent, pushed. Thanks!