summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-annot.c
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-07-30 12:19:11 +0100
committerPaul Gardiner <paulg.artifex@glidos.net>2013-07-30 12:19:11 +0100
commit08ad4bfc090a471b03c08d41c316133b3884eb19 (patch)
treed09b5734ec64df08af4d904673b9720d3ac5fd82 /source/pdf/pdf-annot.c
parent324defe51aae2d8ca012caa6d555addca288766a (diff)
downloadmupdf-08ad4bfc090a471b03c08d41c316133b3884eb19.tar.xz
For freetext annotations, distinguish device and page space correctly.
Diffstat (limited to 'source/pdf/pdf-annot.c')
-rw-r--r--source/pdf/pdf-annot.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index c0254756..d137b162 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -953,6 +953,7 @@ void pdf_set_free_text_details(pdf_document *doc, pdf_annot *annot, fz_point *po
pdf_da_info da_info;
fz_buffer *fzbuf = NULL;
fz_matrix ctm;
+ fz_point page_pos;
fz_invert_matrix(&ctm, &annot->page->ctm);
@@ -1008,16 +1009,18 @@ void pdf_set_free_text_details(pdf_document *doc, pdf_annot *annot, fz_point *po
font_desc = pdf_load_font(doc, NULL, font, 0);
pdf_measure_text(ctx, font_desc, (unsigned char *)text, strlen(text), &bounds);
+ page_pos = *pos;
+ fz_transform_point(&page_pos, &ctm);
+
bounds.x0 *= font_size;
bounds.x1 *= font_size;
bounds.y0 *= font_size;
bounds.y1 *= font_size;
- bounds.x0 += pos->x;
- bounds.x1 += pos->x;
- bounds.y0 += pos->y;
- bounds.y1 += pos->y;
- fz_transform_rect(&bounds, &ctm);
+ bounds.x0 += page_pos.x;
+ bounds.x1 += page_pos.x;
+ bounds.y0 += page_pos.y;
+ bounds.y1 += page_pos.y;
pdf_dict_puts_drop(annot->obj, "Rect", pdf_new_rect(doc, &bounds));
update_rect(ctx, annot);