diff options
author | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2017-12-09 14:07:09 +0000 |
---|---|---|
committer | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2017-12-09 14:07:09 +0000 |
commit | 9a03dd60f3227afcfd242b9633edbc0d83ffd02e (patch) | |
tree | f213ffadb2bf59b64015588ade7ad37a1d74b1ba | |
parent | fb0976eba4285e6fb42abd23bbe2e7a8fbf5563c (diff) |
dvipdfm-x/tt_cmap.c: import ToUnicode fix by jjgod
git-svn-id: svn://tug.org/texlive/trunk@46025 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/tt_cmap.c | 27 |
2 files changed, 20 insertions, 13 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 223e88715c2..80e96977c5b 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,9 @@ +2017-12-09 Jiang Jiang <gzjjgod@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@yahoo.co.jp> * dvi.c: Initialize direction mode in clear_state(). See diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c index 38a8e15ea92..3ed64b681be 100644 --- a/Build/source/texk/dvipdfm-x/tt_cmap.c +++ b/Build/source/texk/dvipdfm-x/tt_cmap.c @@ -857,7 +857,9 @@ handle_CIDFont (sfnt *sfont, 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 @@ add_to_cmap_if_used (CMap *cmap, { 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 @@ 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); - /* 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; |