From b79dd6ae4d3baac68fe5832062f6e35a621bc923 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 2 Oct 2018 01:01:17 +0000 Subject: Fixed a bug in MetaPost PostScript handling (S. Hirata) [recommitting 48797 from kakuto] git-svn-id: svn://tug.org/texlive/trunk@48797 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 9 +++- Build/source/texk/dvipdfm-x/configure | 22 +++++----- Build/source/texk/dvipdfm-x/configure.ac | 2 +- Build/source/texk/dvipdfm-x/dvipdfmx.c | 10 ++--- Build/source/texk/dvipdfm-x/mpost.c | 70 ++++++++++++++++---------------- 5 files changed, 59 insertions(+), 54 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 2aad24c11e7..b4841c875ce 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,7 +1,14 @@ +2018-10-02 Shunsaku Hirata + + * 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 * 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. diff --git a/Build/source/texk/dvipdfm-x/configure b/Build/source/texk/dvipdfm-x/configure index cbf175976ff..3f0871d7980 100755 --- a/Build/source/texk/dvipdfm-x/configure +++ b/Build/source/texk/dvipdfm-x/configure @@ -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 . # @@ -590,8 +590,8 @@ MAKEFLAGS= # 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@tug.org' PACKAGE_URL='' @@ -1350,7 +1350,7 @@ if test "$ac_init_help" = "long"; then # 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 @@ fi 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 @@ fi 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 @@ cat >config.log <<_ACEOF 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 @@ fi # Define the identity of the package. PACKAGE='dvipdfm-x--tex-live-' - VERSION='20180916' + VERSION='20181002' cat >>confdefs.h <<_ACEOF @@ -14744,7 +14744,7 @@ Usage: $0 [OPTIONS] Report bugs to ." 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 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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 @@ _ACEOF 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\\" diff --git a/Build/source/texk/dvipdfm-x/configure.ac b/Build/source/texk/dvipdfm-x/configure.ac index f0a3b7eb09e..ff5b8b53cfe 100644 --- a/Build/source/texk/dvipdfm-x/configure.ac +++ b/Build/source/texk/dvipdfm-x/configure.ac @@ -7,7 +7,7 @@ dnl This file is free software; the copyright holder 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@tug.org]) +AC_INIT([dvipdfm-x (TeX Live)], [20181002], [tex-k@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([agl.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c index cd644e646f1..e20da281e49 100644 --- a/Build/source/texk/dvipdfm-x/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c @@ -506,6 +506,10 @@ do_args_first_pass (int argc, char *argv[], const char *source, int unsafe) case 'v': verbose++; + case 'M': + dpx_conf.compat_mode = dpx_mode_mpost_mode; + break; + default: /* ignore everything else */ break; } @@ -543,7 +547,7 @@ do_args_second_pass (int argc, char *argv[], const char *source, int unsafe) 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 @@ do_args_second_pass (int argc, char *argv[], const char *source, int unsafe) 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); diff --git a/Build/source/texk/dvipdfm-x/mpost.c b/Build/source/texk/dvipdfm-x/mpost.c index b38c44b9fcf..f583de88308 100644 --- a/Build/source/texk/dvipdfm-x/mpost.c +++ b/Build/source/texk/dvipdfm-x/mpost.c @@ -95,9 +95,24 @@ static struct mp_font } 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 @@ -115,17 +130,6 @@ mp_setfont (const char *font_name, double pt_size) 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 @@ save_font (void) { 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 @@ restore_font (void) 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 @@ static void 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 @@ do_currentfont (void) pdf_obj *font_dict; font = CURRENT_FONT(); - if (!font) { + if (!FONT_DEFINED(font)) { WARN("Currentfont undefined..."); return 1; } else { @@ -785,7 +783,7 @@ do_show (void) double text_width; font = CURRENT_FONT(); - if (!font) { + if (!FONT_DEFINED(font)) { WARN("Currentfont not set."); /* Should not be error... */ return 1; } -- cgit v1.2.3