GNOME Bugzilla – Bug 750569
Markup annotations of subtype Underline are drawn ABOVE the marked text
Last modified: 2015-06-13 07:33:03 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"
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 on attachment 304786 [details] [review] pdf: Fixed wrong order of QuadPoints in get_quads_for_area. Excellent, pushed. Thanks!