From 51fb659674f3b6f8a1f5944e73b4fb9fdf90a14c Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 6 Aug 2017 07:12:02 +0000 Subject: xetexdir/pdfimage.cpp: : Support /Rotate in PDF inclusion. git-svn-id: svn://tug.org/texlive/trunk@44964 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/ChangeLog | 5 +++++ Build/source/texk/web2c/xetexdir/pdfimage.cpp | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'Build/source/texk/web2c/xetexdir') diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index 18c4be0866d..668f746f51a 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,8 @@ +2017-03-17 Akira Kakuto + + * pdfimage.cpp: Support /Rotate in PDF image inclusion with + the new xdvipdfmx-20170806. + 2017-07-17 Jonathan Kew * xetex.ch: Set a non-zero exit code if the pipe diff --git a/Build/source/texk/web2c/xetexdir/pdfimage.cpp b/Build/source/texk/web2c/xetexdir/pdfimage.cpp index 8538913692c..fc3e3269340 100644 --- a/Build/source/texk/web2c/xetexdir/pdfimage.cpp +++ b/Build/source/texk/web2c/xetexdir/pdfimage.cpp @@ -1,7 +1,7 @@ /****************************************************************************\ Part of the XeTeX typesetting system Copyright (c) 1994-2008 by SIL International - Copyright (c) 2009, 2011 by Jonathan Kew + Copyright (c) 2009, 2017 by Jonathan Kew SIL Author(s): Jonathan Kew @@ -98,6 +98,28 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box) break; } + int RotAngle = 0; + RotAngle = (int)page->getRotate() % 360; + if (RotAngle < 0) + RotAngle += 360; + if (RotAngle == 90 || RotAngle == 270) { + double tmpvalue; + if (r->x1 > r->x2) { + tmpvalue = r->x1; + r->x1 = r->x2; + r->x2 = tmpvalue; + } + if (r->y1 > r->y2) { + tmpvalue = r->y1; + r->y1 = r->y2; + r->y2 = tmpvalue; + } + + tmpvalue = r->x2; + r->x2 = r->x1 + r->y2 - r->y1; + r->y2 = r->y1 + tmpvalue - r->x1; + } + box->x = 72.27 / 72 * my_fmin(r->x1, r->x2); box->y = 72.27 / 72 * my_fmin(r->y1, r->y2); box->wd = 72.27 / 72 * fabs(r->x2 - r->x1); -- cgit v1.2.3