texlive[46025] Build/source/texk/dvipdfm-x: dvipdfm-x/tt_cmap.c:

commits+hironobu at tug.org commits+hironobu at tug.org
Sat Dec 9 15:07:09 CET 2017


Revision: 46025
          http://tug.org/svn/texlive?view=revision&revision=46025
Author:   hironobu
Date:     2017-12-09 15:07:09 +0100 (Sat, 09 Dec 2017)
Log Message:
-----------
dvipdfm-x/tt_cmap.c: import ToUnicode fix by jjgod

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

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2017-12-09 14:00:07 UTC (rev 46024)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2017-12-09 14:07:09 UTC (rev 46025)
@@ -1,3 +1,9 @@
+2017-12-09  Jiang Jiang  <gzjjgod at gmail.com>
+
+	* tt_cmap.c (is_PUA_or_presentation, add_to_cmap_if_used):
+	Skip KANGXI RADICALs which are commonly double encoded.
+	http://tug.org/pipermail/xetex/2017-June/027147.html
+
 2017-10-02  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* dvi.c: Initialize direction mode in clear_state(). See

Modified: trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_cmap.c	2017-12-09 14:00:07 UTC (rev 46024)
+++ trunk/Build/source/texk/dvipdfm-x/tt_cmap.c	2017-12-09 14:07:09 UTC (rev 46025)
@@ -857,7 +857,9 @@
 
 static int is_PUA_or_presentation (unsigned int uni)
 {
-  return  ((uni >= 0xE000 && uni <= 0xF8FF) || (uni >= 0xFB00 && uni <= 0xFB4F) ||
+  /* KANGXI RADICALs are commonly double encoded. */
+  return  ((uni >= 0x2F00 && uni <= 0x2FD5) ||
+           (uni >= 0xE000 && uni <= 0xF8FF) || (uni >= 0xFB00 && uni <= 0xFB4F) ||
            (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD));
 }
 
@@ -1019,7 +1021,13 @@
 {
   USHORT count = 0;
   USHORT cid = cffont ? cff_charsets_lookup_inverse(cffont, gid) : gid;
-  if (is_used_char2(used_chars, cid)) {
+
+  /* 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)) {
     int len;
     unsigned char *p = wbuf + 2;
 
@@ -1030,18 +1038,11 @@
     len = UC_UTF16BE_encode_char((int32_t) ch, &p, wbuf + WBUF_SIZE);
     CMap_add_bfchar(cmap, wbuf, 2, wbuf + 2, len);
 
-    /* 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.
+    /* Avoid duplicate entry
+     * There are problem when two Unicode code is mapped to
+     * single glyph...
      */
-    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)));
-    }
+    used_chars[cid / 8] &= ~(1 << (7 - (cid % 8)));
   }
 
   return count;



More information about the tex-live-commits mailing list