[evince/gnome-3-16] pdf: Force text annotations to have a fixed size 24x24



commit e0507bd856931b8c9f588f9de615896f738cdb7c
Author: Philipp Reinkemeier <philipp reinkemeier offis de>
Date:   Thu Jun 4 15:02:23 2015 +0200

    pdf: Force text annotations to have a fixed size 24x24
    
    Some tools create pdf text annotations with a /Rect field, whose
    volume is very small or zero. Nevertheless, one expects tool-tips
    when hovering them, or popup windows to appear when clicking them.
    This patch forces a fixed size for text annotations equal to the size
    of their icons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685334

 backend/pdf/ev-poppler.cc |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index c17461d..e80a5d1 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -3062,10 +3062,18 @@ pdf_document_annotations_get_annotations (EvDocumentAnnotations *document_annota
                        annot_set_unique_name (ev_annot);
 
                annot_mapping = g_new (EvMapping, 1);
-               annot_mapping->area.x1 = mapping->area.x1;
-               annot_mapping->area.x2 = mapping->area.x2;
-               annot_mapping->area.y1 = height - mapping->area.y2;
-               annot_mapping->area.y2 = height - mapping->area.y1;
+               if (EV_IS_ANNOTATION_TEXT (ev_annot)) {
+                       /* Force 24x24 rectangle */
+                       annot_mapping->area.x1 = mapping->area.x1;
+                       annot_mapping->area.x2 = annot_mapping->area.x1 + 24;
+                       annot_mapping->area.y1 = height - mapping->area.y2;
+                       annot_mapping->area.y2 = MIN(height, annot_mapping->area.y1 + 24);
+               } else {
+                       annot_mapping->area.x1 = mapping->area.x1;
+                       annot_mapping->area.x2 = mapping->area.x2;
+                       annot_mapping->area.y1 = height - mapping->area.y2;
+                       annot_mapping->area.y2 = height - mapping->area.y1;
+               }
                annot_mapping->data = ev_annot;
 
                g_object_set_data_full (G_OBJECT (ev_annot),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]