Skip to content

Commit

Permalink
Revert "Adds translattion of highlight annotations"
Browse files Browse the repository at this point in the history
This reverts commit 0107f80

The reason for doing this is explained by @Vizs in vedang#143, copying the
message here:

Andreas wrote the function
`annotation_translate_quadrilateral`[^1][^2] to fix misplaced
annotations due to the then bug in `glib`. This misplacement bug can
be seen in the images posted in issue politza/pdf-tools#577, along
with PDFs in which the bug can be reproduced.

This lack of translation in the `glib` backend was fixed in `poppler
0.86.0` but the workaround was still left hanging in `epdfinfo.c`
which brings us to today where this unneeded translation bites our
back. I commented out the calls to
`annotation_translate_quadrilateral` in `epdinfo.c` and to my
surprise, there were no misplaced translations in files which
displayed the misplacing behaviour and in files which did not have
this behaviour.

[1]:
politza/pdf-tools@0107f80
[2]: politza/pdf-tools#122

Closes: vedang#143
Closes: vedang#146
  • Loading branch information
vedang committed Oct 4, 2022
1 parent aec8ecd commit a4905d8
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions server/epdfinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,25 +1309,6 @@ annotation_get_by_key (document_t *doc, const gchar *key)
}

#ifdef HAVE_POPPLER_ANNOT_MARKUP
void
annotation_translate_quadrilateral (PopplerPage *page, PopplerQuadrilateral *q, gboolean inverse)
{
PopplerRectangle cbox;
gdouble xs, ys;

poppler_page_get_crop_box (page, &cbox);
xs = MIN (cbox.x1, cbox.x2);
ys = MIN (cbox.y1, cbox.y2);

if (inverse)
{
xs = -xs; ys = -ys;
}

q->p1.x -= xs, q->p2.x -= xs; q->p3.x -= xs; q->p4.x -= xs;
q->p1.y -= ys, q->p2.y -= ys; q->p3.y -= ys; q->p4.y -= ys;
}

static cairo_region_t*
annotation_markup_get_text_regions (PopplerPage *page, PopplerAnnotTextMarkup *a)
{
Expand All @@ -1343,7 +1324,6 @@ annotation_markup_get_text_regions (PopplerPage *page, PopplerAnnotTextMarkup *a
PopplerQuadrilateral *q = &g_array_index (quads, PopplerQuadrilateral, i);
cairo_rectangle_int_t r;

annotation_translate_quadrilateral (page, q, FALSE);
q->p1.y = height - q->p1.y;
q->p2.y = height - q->p2.y;
q->p3.y = height - q->p3.y;
Expand Down Expand Up @@ -1398,7 +1378,6 @@ annotation_markup_append_text_region (PopplerPage *page, PopplerRectangle *regio
q.p3.x = r->x1;
q.p3.y = height - r->y2;

annotation_translate_quadrilateral (page, &q, TRUE);
g_array_append_val (garray, q);
}
g_list_free (regions);
Expand Down

0 comments on commit a4905d8

Please sign in to comment.