texlive[48797] Build/source/texk/dvipdfm-x: Fixed a bug in MetaPost

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Oct 1 23:05:32 CEST 2018


Revision: 48797
          http://tug.org/svn/texlive?view=revision&revision=48797
Author:   kakuto
Date:     2018-10-01 23:05:31 +0200 (Mon, 01 Oct 2018)
Log Message:
-----------
Fixed a bug in MetaPost PostScript handling (S. Hirata)

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/configure
    trunk/Build/source/texk/dvipdfm-x/configure.ac
    trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
    trunk/Build/source/texk/dvipdfm-x/mpost.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-10-01 07:54:03 UTC (rev 48796)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-10-01 21:05:31 UTC (rev 48797)
@@ -1,7 +1,14 @@
+2018-10-02  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
+
+	* dvipdfmx.c: Fixed a bug in handling of command line option '-M'.
+	* mpost.c:  Fixed a bug in MetaPost generated PS files.
+	Font selection had not been properly done for gsave/grestore.
+	* configure.ac: Version 20181002.
+
 2018-09-16  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
 
 	* dvi.[ch], dvipdfmx.c: Fixed a bug that papersize special does
-	not work. (introduced in the previous change) Command line
+	not work (introduced in the previous change). Command line
 	options other than papersize now take precedence over special
 	command options.
 	* dpxconf.[ch], tt_aux.c: Moved always_embed flag to dpx_conf.

Modified: trunk/Build/source/texk/dvipdfm-x/configure
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure	2018-10-01 07:54:03 UTC (rev 48796)
+++ trunk/Build/source/texk/dvipdfm-x/configure	2018-10-01 21:05:31 UTC (rev 48797)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20180916.
+# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20181002.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='dvipdfm-x (TeX Live)'
 PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20180916'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20180916'
+PACKAGE_VERSION='20181002'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20181002'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -1350,7 +1350,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures dvipdfm-x (TeX Live) 20180916 to adapt to many kinds of systems.
+\`configure' configures dvipdfm-x (TeX Live) 20181002 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1421,7 +1421,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20180916:";;
+     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20181002:";;
    esac
   cat <<\_ACEOF
 
@@ -1551,7 +1551,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dvipdfm-x (TeX Live) configure 20180916
+dvipdfm-x (TeX Live) configure 20181002
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2390,7 +2390,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by dvipdfm-x (TeX Live) $as_me 20180916, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20181002, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -8075,7 +8075,7 @@
 
 # Define the identity of the package.
  PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20180916'
+ VERSION='20181002'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14744,7 +14744,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20180916
+dvipdfm-x (TeX Live) config.lt 20181002
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -16624,7 +16624,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by dvipdfm-x (TeX Live) $as_me 20180916, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20181002, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16694,7 +16694,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-dvipdfm-x (TeX Live) config.status 20180916
+dvipdfm-x (TeX Live) config.status 20181002
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/texk/dvipdfm-x/configure.ac
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure.ac	2018-10-01 07:54:03 UTC (rev 48796)
+++ trunk/Build/source/texk/dvipdfm-x/configure.ac	2018-10-01 21:05:31 UTC (rev 48797)
@@ -7,7 +7,7 @@
 dnl   gives unlimited permission to copy and/or distribute it,
 dnl   with or without modifications, as long as this notice is preserved.
 dnl
-AC_INIT([dvipdfm-x (TeX Live)], [20180916], [tex-k at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20181002], [tex-k at tug.org])
 AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR([agl.c])
 AC_CONFIG_AUX_DIR([../../build-aux])

Modified: trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2018-10-01 07:54:03 UTC (rev 48796)
+++ trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2018-10-01 21:05:31 UTC (rev 48797)
@@ -506,6 +506,10 @@
     case 'v':
       verbose++;
 
+   case 'M':
+      dpx_conf.compat_mode = dpx_mode_mpost_mode;
+      break;
+
     default: /* ignore everything else */
       break;
     }
@@ -543,7 +547,7 @@
   optind = 1;
   while ((c = getopt_long(argc, argv, optstrig, long_options, NULL)) != -1) {
     switch(c) {
-    case 'h': case 130: case 131: case 132: case 133: case 1000: case 'q': case 'v': /* already done */
+    case 'h': case 130: case 131: case 132: case 133: case 1000: case 'q': case 'v': case 'M': /* already done */
       break;
 
     case 'D':
@@ -670,10 +674,6 @@
       bookmark_open = atoi(optarg);
       break;
 
-    case 'M':
-      dpx_conf.compat_mode = dpx_mode_mpost_mode;
-      break;
-
     case 'C':
     {
       int flags = (unsigned) strtol(optarg, &nextptr, 0);

Modified: trunk/Build/source/texk/dvipdfm-x/mpost.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/mpost.c	2018-10-01 07:54:03 UTC (rev 48796)
+++ trunk/Build/source/texk/dvipdfm-x/mpost.c	2018-10-01 21:05:31 UTC (rev 48797)
@@ -95,10 +95,25 @@
 } font_stack[PDF_GSAVE_MAX] = {
   {NULL, -1, -1, -1, 0}
 };
-static int currentfont = -1;
+static int currentfont = 0;
 
 #define CURRENT_FONT() ((currentfont < 0) ? NULL : &font_stack[currentfont])
+#define FONT_DEFINED(f) ((f) && (f)->font_name && ((f)->font_id >= 0))
 
+static void
+clear_mp_font_struct (struct mp_font *font)
+{
+  ASSERT(font);
+
+  if (font->font_name)
+    RELEASE(font->font_name);
+  font->font_name  = NULL;
+  font->font_id    = -1;
+  font->tfm_id     = -1;
+  font->subfont_id = -1;
+  font->pt_size    = 0.0;
+}
+
 /* Compatibility */
 #define MP_CMODE_MPOST    0
 #define MP_CMODE_DVIPSK   1
@@ -115,17 +130,6 @@
 
   font = CURRENT_FONT();
 
-  if (font) {
-    if (!strcmp(font->font_name, font_name) &&
-        font->pt_size == pt_size)
-      return  0;
-  } else { /* No currentfont */
-/* ***TODO*** Here some problem exists! */
-    font = &font_stack[0];
-    font->font_name = NULL;
-    currentfont = 0;
-  }
-
   mrec = pdf_lookup_fontmap_record(font_name);
   if (mrec && mrec->charmap.sfd_name && mrec->charmap.subfont_id) {
     subfont_id = sfd_load_record(mrec->charmap.sfd_name, mrec->charmap.subfont_id);
@@ -161,23 +165,22 @@
 {
   struct mp_font *current, *next;
 
-  if (currentfont < 0) {
-    font_stack[0].font_name  = NEW(strlen("Courier") + 1, char);
-    strcpy(font_stack[0].font_name, "Courier");
-    font_stack[0].pt_size    = 1;
-    font_stack[0].tfm_id     = 0;
-    font_stack[0].subfont_id = 0;
-    currentfont = 0;
-  }
-
   current = &font_stack[currentfont++];
   next    = &font_stack[currentfont  ];
-  next->font_name  = NEW(strlen(current->font_name)+1, char);
-  strcpy(next->font_name, current->font_name);
-  next->pt_size    = current->pt_size;
-
-  next->subfont_id = current->subfont_id;
-  next->tfm_id     = current->tfm_id;
+  if (FONT_DEFINED(current)) {
+    next->font_name = NEW(strlen(current->font_name)+1, char);
+    strcpy(next->font_name, current->font_name);
+    next->font_id    = current->font_id;
+    next->pt_size    = current->pt_size;
+    next->subfont_id = current->subfont_id;
+    next->tfm_id     = current->tfm_id;    
+  } else {
+    next->font_name  = NULL;
+    next->font_id    = -1;
+    next->pt_size    = 0.0;
+    next->subfont_id = -1;
+    next->tfm_id     = -1;
+  }
 }
 
 static void
@@ -187,11 +190,7 @@
 
   current = CURRENT_FONT();
   if (current) {
-    if (current->font_name)
-      RELEASE(current->font_name);
-    current->font_name = NULL;
-  } else {
-    ERROR("No currentfont...");
+    clear_mp_font_struct(current);
   }
 
   currentfont--;
@@ -201,8 +200,7 @@
 clear_fonts (void)
 {
   while (currentfont >= 0) {
-    if (font_stack[currentfont].font_name)
-      RELEASE(font_stack[currentfont].font_name);
+    clear_mp_font_struct(&font_stack[currentfont]);
     currentfont--;
   }
 }
@@ -748,7 +746,7 @@
   pdf_obj        *font_dict;
 
   font = CURRENT_FONT();
-  if (!font) {
+  if (!FONT_DEFINED(font)) {
     WARN("Currentfont undefined...");
     return 1;
   } else {
@@ -785,7 +783,7 @@
   double          text_width;
 
   font = CURRENT_FONT();
-  if (!font) {
+  if (!FONT_DEFINED(font)) {
     WARN("Currentfont not set."); /* Should not be error... */
     return 1;
   }



More information about the tex-live-commits mailing list