summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2014-04-30 17:46:42 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2014-04-30 17:46:42 +0000
commit6450333cf805ef750a9b68c87c483dee0f21a9da (patch)
tree9f61ce578102a0f5f5ea666102995eaab911fb69 /Build/source/texk
parent402f016e9c8bdc8d65d50f0153d2c65f55ffd3b9 (diff)
prefere glyph name for glyph with PUA or alphabetic presentation forms entries in font cmap
A slightly modified version of a patch from Alexey Kryukov. git-svn-id: svn://tug.org/texlive/trunk@33767 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog5
-rw-r--r--Build/source/texk/dvipdfm-x/tt_cmap.c44
2 files changed, 42 insertions, 7 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index a7347e805f5..9a28d16338c 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-30 Khaled Hosny <khaledhosny@eglug.org>
+
+ * tt_cmap.c: [XDVIPDFMX] prefere glyph name for glyph with PUA or
+ alphabetic presentation forms entries in font cmap.
+
2014-04-24 Karl Berry <karl@tug.org>
* man/dvipdfm.1,
diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c
index 9450773c05b..aa49979be6c 100644
--- a/Build/source/texk/dvipdfm-x/tt_cmap.c
+++ b/Build/source/texk/dvipdfm-x/tt_cmap.c
@@ -837,6 +837,14 @@ handle_CIDFont (sfnt *sfont,
return 1;
}
+#ifdef XETEX
+static int is_PUA_or_presentation (unsigned int uni)
+{
+ return ((uni >= 0xE000 && uni <= 0xF8FF) || (uni >= 0xFB00 && uni <= 0xFB4F) ||
+ (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD));
+}
+#endif
+
/*
* Substituted glyphs:
*
@@ -870,7 +878,7 @@ handle_subst_glyphs (CMap *cmap,
continue;
if (!cmap_add) {
-#if XETEX
+#ifdef XETEX
if (FT_HAS_GLYPH_NAMES(sfont->ft_face)) {
/* JK: try to look up Unicode values from the glyph name... */
#define MAX_UNICODES 16
@@ -987,11 +995,19 @@ create_ToUnicode_cmap4 (struct cmap4 *map,
CMap_add_bfchar(cmap, wbuf, 2, wbuf+2, 2);
- /* Avoid duplicate entry
- * There are problem when two Unicode code is mapped to
- * single glyph...
- */
- used_glyphs_copy[gid/8] &= ~(1 << (7 - (gid % 8)));
+#ifdef XETEX
+ /* 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_PUA_or_presentation(ch))
+#endif
+ /* Avoid duplicate entry
+ * There are problem when two Unicode code is mapped to
+ * single glyph...
+ */
+ used_glyphs_copy[gid/8] &= ~(1 << (7 - (gid % 8)));
count++;
}
}
@@ -1046,8 +1062,22 @@ create_ToUnicode_cmap12 (struct cmap12 *map,
wbuf[1] = (gid & 0xff);
len = UC_sput_UTF16BE((long)ch, &p, wbuf+WBUF_SIZE);
- used_glyphs_copy[gid/8] &= ~(1 << (7 - (gid % 8)));
CMap_add_bfchar(cmap, wbuf, 2, wbuf+2, len);
+
+#ifdef XETEX
+ /* 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_PUA_or_presentation(ch))
+#endif
+ /* Avoid duplicate entry
+ * There are problem when two Unicode code is mapped to
+ * single glyph...
+ */
+ used_glyphs_copy[gid/8] &= ~(1 << (7 - (gid % 8)));
+ count++;
}
}
}