texlive[53691] Build/source/texk/dvipdfm-x: add support for some

commits+kakuto at tug.org commits+kakuto at tug.org
Thu Feb 6 11:12:40 CET 2020


Revision: 53691
          http://tug.org/svn/texlive?view=revision&revision=53691
Author:   kakuto
Date:     2020-02-06 11:12:39 +0100 (Thu, 06 Feb 2020)
Log Message:
-----------
add support for some pdftex specials: pdf:page: and pdf:direct: (from S. Hirata)

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-02-06 09:19:24 UTC (rev 53690)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2020-02-06 10:12:39 UTC (rev 53691)
@@ -6,6 +6,12 @@
 	regarded simply as an empty string if it is NULL from now on.
 	See https://tex.stackexchange.com/questions/522794/problem-in-updated-tex-live,
 	although we can't reproduce the problem.
+	* spc_pdfm.c: Add two pdftex specials which are basically
+	similar to the existing dvipdfmx special "pdf:literal",
+	"pdf:page:" and "pdf:direct:". It is not possible to test
+	properly since exact spec is unknown to us. Currently,
+	"pdf:direct:" is just an alias of "pdf:page:". It cannot be
+	properly implemented at present.
 
 2020-01-24  Akira Kakuto  <kakuto at w32tex.org>
 

Modified: trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2020-02-06 09:19:24 UTC (rev 53690)
+++ trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2020-02-06 10:12:39 UTC (rev 53691)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2007-2019 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2007-2020 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -2092,6 +2092,20 @@
   return 0;
 }
 
+static int
+spc_handler_pdft_compat_page (struct spc_env *spe, struct spc_arg *args)
+{
+  skip_white(&args->curptr, args->endptr);
+  if (args->curptr < args->endptr) {
+    pdf_doc_add_page_content(" ", 1);  /* op: */
+    pdf_doc_add_page_content(args->curptr, (int) (args->endptr - args->curptr));  /* op: ANY */
+  }
+
+  args->curptr = args->endptr;
+
+  return 0;
+}
+
 static struct spc_handler pdfm_handlers[] = {
   {"annotation", spc_handler_pdfm_annot},
   {"annotate",   spc_handler_pdfm_annot},
@@ -2207,6 +2221,15 @@
   {"trailerid", spc_handler_pdfm_do_nothing},
 };
 
+static struct spc_handler pdft_compat_handlers[] = {
+  /* Text supplied to "direct" command should go inside of BT/ET block
+   * but dvipdfmx currently can't be implemented so.
+   * Here, "direct" is for the moment just an alias of "page".
+   */
+  {"direct", spc_handler_pdft_compat_page},
+  {"page", spc_handler_pdft_compat_page},
+};
+
 int
 spc_pdfm_check_special (const char *buf, int len)
 {
@@ -2245,17 +2268,36 @@
   skip_white(&ap->curptr, ap->endptr);
   q = parse_c_ident(&ap->curptr, ap->endptr);
   if (q) {
-    for (i = 0;
-         i < sizeof(pdfm_handlers) / sizeof(struct spc_handler); i++) {
-      if (!strcmp(q, pdfm_handlers[i].key)) {
-        ap->command = pdfm_handlers[i].key;
-        sph->key   = "pdf:";
-        sph->exec  = pdfm_handlers[i].exec;
-        skip_white(&ap->curptr, ap->endptr);
-        error = 0;
-        break;
+    int is_pdft_compat = 0;
+    if (ap->curptr < ap->endptr) {
+      if (ap->curptr[0] == ':') {
+        is_pdft_compat = 1;
+        ap->curptr++;
       }
     }
+    if (is_pdft_compat) {
+      for (i = 0; i < sizeof(pdft_compat_handlers) / sizeof(struct spc_handler); i++) {
+        if (!strcmp(q, pdft_compat_handlers[i].key)) {
+          ap->command = pdft_compat_handlers[i].key;
+          sph->key   = "pdf:";
+          sph->exec  = pdft_compat_handlers[i].exec;
+          skip_white(&ap->curptr, ap->endptr);
+          error = 0;
+          break;
+        }
+      }
+    } else {
+      for (i = 0; i < sizeof(pdfm_handlers) / sizeof(struct spc_handler); i++) {
+        if (!strcmp(q, pdfm_handlers[i].key)) {
+          ap->command = pdfm_handlers[i].key;
+          sph->key   = "pdf:";
+          sph->exec  = pdfm_handlers[i].exec;
+          skip_white(&ap->curptr, ap->endptr);
+          error = 0;
+          break;
+        }
+      }
+    }
     RELEASE(q);
   }
 



More information about the tex-live-commits mailing list.