From 3710f078b9f3df433489ca3da6f8182e1dc8520c Mon Sep 17 00:00:00 2001 From: Philipp Reinkemeier Date: Thu, 4 Jun 2015 15:02:23 +0200 Subject: 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 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index e04ce01..56a29c5 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -3102,10 +3102,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), -- cgit v0.12