[Poppler-bugs] [Bug 51487] [PATCH] Add support for TextMarkup Annotations in glib frontend

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Aug 3 03:45:49 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=51487

--- Comment #48 from Jose Aliste <jose.aliste at gmail.com> ---
What's the problem with using get_selection_region? I was even thinking on
adding a poppler_markup_annot_set_to_selection (annot, rectangle) that would
internally 
add the quadrilaterals according to the selection given by the rectangle, using
a method similar to get_selection_region inside... This would save us from all
the Quads->PopplerQuads->EvQuads conversions while constructing the annotation
during drag and drop. 

Otherwise, I believe that poppler_page_get_selection_region is exactly the
method we should use. I even argue for having a method
poppler_page_get_quadrilaterals_from_region or something like that that already
constructs the array of quadrilaterals... 

The fact that the rectangles associated to lines overlap is what makes the
cairo_region_t method useless (cairo_region_t is optimized for clipping and
drawing, so when you make a union_rectangle, it basically merges rectangles
when it can). I think that is is fairly trivial to make the rectangles not to
overlap, we need to override TextSelectionSizer::visitLine.

Currently it does something like this

  margin = (line->yMax - line->yMin) / 8;
  x1 = line->edge[edge_begin];
  y1 = line->yMin - margin;
  x2 = line->edge[edge_end];
  y2 = line->yMax + margin;

  rect = new PDFRectangle (floor (x1 * scale),
                           floor (y1 * scale),
                           ceil (x2 * scale),
                           ceil (y2 * scale));
so you clearly see that it's adding a margin to the rectangles. We could just
override the method in a new class and use this class in the
poppler_page_quadrilaterals_from_selection or in the
poppler_anno_set_quadrilaterals_from_selection

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20140803/d10e32d7/attachment.html>


More information about the Poppler-bugs mailing list