summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-03-01 05:01:56 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-03-01 05:01:56 +0000
commit4e1b00df3ab160016561968ea80aae4a7024891e (patch)
treec7394a4b9521b7571f67fbdd7fa79bb8cff71b06 /Build/source
parent97b7dc40d110a895447e136326be560e499235f3 (diff)
dvipdfm-x: -p option wins papersize and pagesize specials, as dvips
git-svn-id: svn://tug.org/texlive/trunk@43367 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog5
-rw-r--r--Build/source/texk/dvipdfm-x/dvipdfmx.c23
2 files changed, 28 insertions, 0 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 5b7bd629acd..fe6bdf527b3 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * dvipdfmx.c: Command line -p option wins papersize and pagesize
+ specials, as dvips.
+
2017-02-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* dvi.c: Add possibly forgotten braces.
diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c
index fb68318841c..2d0f9269b66 100644
--- a/Build/source/texk/dvipdfm-x/dvipdfmx.c
+++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c
@@ -119,6 +119,8 @@ double paper_height = 842.0;
static double x_offset = 72.0;
static double y_offset = 72.0;
int landscape_mode = 0;
+static int psize_optionp = 0;
+static char *psize_optarg = NULL;
int always_embed = 0; /* always embed fonts, regardless of licensing flags */
@@ -471,6 +473,12 @@ do_args (int argc, char *argv[], const char *source, int unsafe)
const char *nnextptr;
optind = 1;
+ /* clear psize_optionp and psize_optarg here, since do_args()
+ is called several times */
+ psize_optionp = 0;
+ if (psize_optarg)
+ RELEASE(psize_optarg);
+ psize_optarg = NULL;
while ((c = getopt_long(argc, argv, optstrig, long_options, NULL)) != -1) {
switch(c) {
@@ -533,6 +541,14 @@ do_args (int argc, char *argv[], const char *source, int unsafe)
case 'p':
select_paper(optarg);
+ /* save data for later use in order to overwrite papersize and
+ pagesize specials */
+ psize_optionp = 1;
+ /* there may be multiple -p options */
+ if (psize_optarg)
+ RELEASE(psize_optarg);
+ psize_optarg = NEW(strlen(optarg) + 1, char);
+ strcpy(psize_optarg, optarg);
break;
case 'c':
@@ -1089,6 +1105,13 @@ main (int argc, char *argv[])
pdf_enc_set_passwd(key_bits, permission, owner_pw, user_pw);
}
}
+ /* overwrite previous papersize by that given in -p option */
+ if (psize_optionp) {
+ select_paper(psize_optarg);
+ RELEASE(psize_optarg);
+ psize_optarg = NULL;
+ psize_optionp = 0;
+ }
if (landscape_mode) {
SWAP(paper_width, paper_height);
}