diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-05-07 21:38:11 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-05-07 21:38:11 +0000 |
commit | 5339b999a18c1ceb3a98c6cc3b2cee75109edfc5 (patch) | |
tree | 031ccb6297632db51efc7dd6c226944681114201 /Build/source | |
parent | e8e42065b3d5c8007da7c14ca4dcacb7c079566e (diff) |
Transformation also applies to annotations created by pdf:ann. (S. Hirata)
git-svn-id: svn://tug.org/texlive/trunk@51040 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/spc_pdfm.c | 103 |
2 files changed, 95 insertions, 13 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index a1894d9b911..c7a72489024 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2019-05-08 Shunsaku Hirata <shunsaku.hirata74@gmail.com> + + * spc_pdfm.c: Transformation also applies to annotations + created by pdf:ann. + 2019-05-07 Shunsaku Hirata <shunsaku.hirata74@gmail.com> * tt_cmap.c: Fix a bug that CFF charset data were not read. diff --git a/Build/source/texk/dvipdfm-x/spc_pdfm.c b/Build/source/texk/dvipdfm-x/spc_pdfm.c index f19d9a081cb..52a5df78b1f 100644 --- a/Build/source/texk/dvipdfm-x/spc_pdfm.c +++ b/Build/source/texk/dvipdfm-x/spc_pdfm.c @@ -597,6 +597,7 @@ parse_pdf_dict_with_tounicode (const char **pp, const char *endptr, struct touni return dict; } +#define SPC_PDFM_SUPPORT_ANNOT_TRANS 1 static int spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args) { @@ -604,7 +605,6 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args) pdf_obj *annot_dict; pdf_rect rect; char *ident = NULL; - pdf_coord cp; transform_info ti; skip_white(&args->curptr, args->endptr); @@ -642,19 +642,96 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args) return -1; } - cp.x = spe->x_user; cp.y = spe->y_user; - pdf_dev_transform(&cp, NULL); - if (ti.flags & INFO_HAS_USER_BBOX) { - rect.llx = ti.bbox.llx + cp.x; - rect.lly = ti.bbox.lly + cp.y; - rect.urx = ti.bbox.urx + cp.x; - rect.ury = ti.bbox.ury + cp.y; - } else { - rect.llx = cp.x; - rect.lly = cp.y - spe->mag * ti.depth; - rect.urx = cp.x + spe->mag * ti.width; - rect.ury = cp.y + spe->mag * ti.height; +#ifdef SPC_PDFM_SUPPORT_ANNOT_TRANS + { + pdf_coord cp1, cp2, cp3, cp4; + /* QuadPoints not working? */ +#ifdef USE_QUADPOINTS + pdf_obj *qpoints; +#endif + if (ti.flags & INFO_HAS_USER_BBOX) { + cp1.x = spe->x_user + ti.bbox.llx; + cp1.y = spe->y_user + ti.bbox.lly; + cp2.x = spe->x_user + ti.bbox.urx; + cp2.y = spe->y_user + ti.bbox.lly; + cp3.x = spe->x_user + ti.bbox.urx; + cp3.y = spe->y_user + ti.bbox.ury; + cp4.x = spe->x_user + ti.bbox.llx; + cp4.y = spe->y_user + ti.bbox.ury; + } else { + cp1.x = spe->x_user; + cp1.y = spe->y_user - spe->mag * ti.depth; + cp2.x = spe->x_user + spe->mag * ti.width; + cp2.y = spe->y_user - spe->mag * ti.depth; + cp3.x = spe->x_user + spe->mag * ti.width; + cp3.y = spe->y_user + spe->mag * ti.height; + cp4.x = spe->x_user; + cp4.y = spe->y_user + spe->mag * ti.height; + } + pdf_dev_transform(&cp1, NULL); + pdf_dev_transform(&cp2, NULL); + pdf_dev_transform(&cp3, NULL); + pdf_dev_transform(&cp4, NULL); + rect.llx = cp1.x; + if (cp2.x < rect.llx) + rect.llx = cp2.x; + if (cp3.x < rect.llx) + rect.llx = cp3.x; + if (cp4.x < rect.llx) + rect.llx = cp4.x; + rect.urx = cp1.x; + if (cp2.x > rect.urx) + rect.urx = cp2.x; + if (cp3.x > rect.urx) + rect.urx = cp3.x; + if (cp4.x > rect.urx) + rect.urx = cp4.x; + rect.lly = cp1.y; + if (cp2.y < rect.lly) + rect.lly = cp2.y; + if (cp3.y < rect.lly) + rect.lly = cp3.y; + if (cp4.y < rect.lly) + rect.lly = cp4.y; + rect.ury = cp1.y; + if (cp2.y > rect.ury) + rect.ury = cp2.y; + if (cp3.y > rect.ury) + rect.ury = cp3.y; + if (cp4.y > rect.ury) + rect.ury = cp4.y; +#ifdef USE_QUADPOINTS + qpoints = pdf_new_array(); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp1.x, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp1.y, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp2.x, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp2.y, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp3.x, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp3.y, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp4.x, 0.01))); + pdf_add_array(qpoints, pdf_new_number(ROUND(cp4.y, 0.01))); + pdf_add_dict(annot_dict, pdf_new_name("QuadPoints"), qpoints); +#endif } +#else + { + pdf_coord cp; + + cp.x = spe->x_user; cp.y = spe->y_user; + pdf_dev_transform(&cp, NULL); + if (ti.flags & INFO_HAS_USER_BBOX) { + rect.llx = ti.bbox.llx + cp.x; + rect.lly = ti.bbox.lly + cp.y; + rect.urx = ti.bbox.urx + cp.x; + rect.ury = ti.bbox.ury + cp.y; + } else { + rect.llx = cp.x; + rect.lly = cp.y - spe->mag * ti.depth; + rect.urx = cp.x + spe->mag * ti.width; + rect.ury = cp.y + spe->mag * ti.height; + } + } +#endif /* Order is important... */ if (ident) |