From fa7ab464293e5f481c87f71cb751b19da76f2509 Mon Sep 17 00:00:00 2001
From: Akira Kakuto <kakuto@fuk.kindai.ac.jp>
Date: Sun, 6 May 2018 09:42:30 +0000
Subject: [PATCH 6/7] recover to give tounicode entries for ligatures

git-svn-id: svn://tug.org/texlive/trunk/Build/source@47625 c570f23f-e606-0410-a88d-b1316a301751
---
 texk/dvipdfm-x/ChangeLog    |  7 +++++++
 texk/dvipdfm-x/configure    | 22 +++++++++++-----------
 texk/dvipdfm-x/configure.ac |  2 +-
 texk/dvipdfm-x/tt_cmap.c    | 32 +++++++++++++-------------------
 4 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/texk/dvipdfm-x/ChangeLog b/texk/dvipdfm-x/ChangeLog
index 384dc1cc2..21f663a51 100644
--- a/texk/dvipdfm-x/ChangeLog
+++ b/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-06  Akira Kakuto  <kakuto@fuk.kindai.ac.jp>
+
+	* tt_cmap.c: Revert a part of changes in 2017-12-09,
+	which breaks to give tounicode entries for ligatures.
+	http://tug.org/pipermail/tex-live/2018-May/041608.html.
+	* configure.ac: Version 20180506.
+
 2018-04-28  Stefan Br\"uns  <stefan.bruens@rwth-aachen.de>
 
 	* pngimage.c: Fix a bug which causes a segfault with 1/2/4-bit
diff --git a/texk/dvipdfm-x/configure b/texk/dvipdfm-x/configure
index 036c643ec..062975689 100755
--- a/texk/dvipdfm-x/configure
+++ b/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) 20180428.
+# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20180506.
 #
 # Report bugs to <tex-k@tug.org>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='dvipdfm-x (TeX Live)'
 PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20180428'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20180428'
+PACKAGE_VERSION='20180506'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20180506'
 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) 20180428 to adapt to many kinds of systems.
+\`configure' configures dvipdfm-x (TeX Live) 20180506 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) 20180428:";;
+     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20180506:";;
    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 20180428
+dvipdfm-x (TeX Live) configure 20180506
 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 20180428, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20180506, 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='20180428'
+ VERSION='20180506'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14744,7 +14744,7 @@ Usage: $0 [OPTIONS]
 Report bugs to <bug-libtool@gnu.org>."
 
 lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20180428
+dvipdfm-x (TeX Live) config.lt 20180506
 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 20180428, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20180506, 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 20180428
+dvipdfm-x (TeX Live) config.status 20180506
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/texk/dvipdfm-x/configure.ac b/texk/dvipdfm-x/configure.ac
index 81c02a96b..dde7348ac 100644
--- a/texk/dvipdfm-x/configure.ac
+++ b/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)], [20180428], [tex-k@tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20180506], [tex-k@tug.org])
 AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR([agl.c])
 AC_CONFIG_AUX_DIR([../../build-aux])
diff --git a/texk/dvipdfm-x/tt_cmap.c b/texk/dvipdfm-x/tt_cmap.c
index 3ed64b681..86689d677 100644
--- a/texk/dvipdfm-x/tt_cmap.c
+++ b/texk/dvipdfm-x/tt_cmap.c
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2007-2017 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     This program is free software; you can redistribute it and/or modify
@@ -928,19 +928,12 @@ handle_subst_glyphs (CMap *cmap,
         }
 #undef MAX_UNICODES
         if (unicode_count == -1) {
-#if defined(LIBDPX)
           if(verbose > VERBOSE_LEVEL_MIN) {
             if (name)
               MESG("No Unicode mapping available: GID=%u, name=%s\n", gid, name);
             else
               MESG("No Unicode mapping available: GID=%u\n", gid);
           }
-#else
-          if (name)
-            MESG("No Unicode mapping available: GID=%u, name=%s\n", gid, name);
-          else
-            MESG("No Unicode mapping available: GID=%u\n", gid);
-#endif /* LIBDPX */
         } else {
           /* the Unicode characters go into wbuf[2] and following, in UTF16BE */
           /* we rely on WBUF_SIZE being more than adequate for MAX_UNICODES  */
@@ -1021,13 +1014,7 @@ add_to_cmap_if_used (CMap *cmap,
 {
   USHORT count = 0;
   USHORT cid = cffont ? cff_charsets_lookup_inverse(cffont, gid) : gid;
-
-  /* Skip PUA characters and alphabetic presentation forms, allowing
-   * handle_subst_glyphs() as it might find better mapping. Fixes the
-   * mapping of ligatures encoded in PUA in fonts like Linux Libertine
-   * and old Adobe fonts.
-   */
-  if (is_used_char2(used_chars, cid) && !is_PUA_or_presentation(ch)) {
+  if (is_used_char2(used_chars, cid)) {
     int len;
     unsigned char *p = wbuf + 2;
 
@@ -1038,11 +1025,18 @@ add_to_cmap_if_used (CMap *cmap,
     len = UC_UTF16BE_encode_char((int32_t) ch, &p, wbuf + WBUF_SIZE);
     CMap_add_bfchar(cmap, wbuf, 2, wbuf + 2, len);
 
-    /* Avoid duplicate entry
-     * There are problem when two Unicode code is mapped to
-     * single glyph...
+    /* Skip PUA characters and alphabetic presentation forms, allowing
+     * handle_subst_glyphs() as it might find better mapping. Fixes the
+     * mapping of ligatures encoded in PUA in fonts like Linux Libertine
+     * and old Adobe fonts.
      */
-    used_chars[cid / 8] &= ~(1 << (7 - (cid % 8)));
+    if (!is_PUA_or_presentation(ch)) {
+      /* Avoid duplicate entry
+       * There are problem when two Unicode code is mapped to
+       * single glyph...
+       */
+      used_chars[cid / 8] &= ~(1 << (7 - (cid % 8)));
+    }
   }
 
   return count;
-- 
2.17.0

