summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorAugusto Stoffel <arstoffel@gmail.com>2023-02-11 17:27:07 +0100
committerVedang Manerikar <ved.manerikar@gmail.com>2023-06-11 00:59:58 +0530
commit97cffdd1b214d0c6e904630468550802d20f4601 (patch)
treec869bb328f8f2ae1769611275ee9c3fc536a4212 /server
parent6a86b29140b4e84d9aff5093c444255c20eef463 (diff)
Allow creation of markup annotations without a text selection
This allows calling `pdf-info-addannot` from Lisp with a nil `markup-edges` argument, which was previously disallowed. In this case, the annotation covers exactly the selected region of the page, without attempting to match it to a certain text region. This means that you can now highlight an exact region! Just select the region by holding down the Meta key and dragging the mouse. Then invoke `pdf-annot-add-highlight-markup-annotation` (with `C-c C-a h`) and voila! Closes: #191
Diffstat (limited to 'server')
-rw-r--r--server/epdfinfo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/epdfinfo.c b/server/epdfinfo.c
index 6d3e14e..b3925d0 100644
--- a/server/epdfinfo.c
+++ b/server/epdfinfo.c
@@ -1635,6 +1635,21 @@ annotation_new (const epdfinfo_t *ctx, document_t *doc, PopplerPage *page,
#ifdef HAVE_POPPLER_ANNOT_MARKUP
garray = g_array_new (FALSE, FALSE, sizeof (PopplerQuadrilateral));
poppler_page_get_size (page, &width, &height);
+ if (nargs == 0)
+ {
+ PopplerQuadrilateral q;
+
+ q.p1.x = r->x1;
+ q.p1.y = r->y1;
+ q.p2.x = r->x2;
+ q.p2.y = r->y1;
+ q.p4.x = r->x2;
+ q.p4.y = r->y2;
+ q.p3.x = r->x1;
+ q.p3.y = r->y2;
+
+ g_array_append_val (garray, q);
+ }
for (i = 0; i < nargs; ++i)
{
PopplerRectangle *rr = &carg.value.rectangle;