From a64f094828834d432a57434df4f4311dd7c114ac Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 12 Dec 2012 00:06:53 +0000 Subject: Fix https://sourceforge.net/p/xetex/bugs/52/ git-svn-id: svn://tug.org/texlive/trunk@28504 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfmx/ChangeLog | 5 +++++ Build/source/texk/dvipdfmx/src/tt_cmap.c | 14 +++++++++++++- Build/source/texk/xdvipdfmx/ChangeLog | 7 ++++++- Build/source/texk/xdvipdfmx/src/tt_cmap.c | 14 +++++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/dvipdfmx/ChangeLog b/Build/source/texk/dvipdfmx/ChangeLog index 4efa8ecfa55..d33a5faae00 100644 --- a/Build/source/texk/dvipdfmx/ChangeLog +++ b/Build/source/texk/dvipdfmx/ChangeLog @@ -1,3 +1,8 @@ +2012-12-12 Khaled Hosny + + * src/tt_cmap.c: Make sure CMapName of embedded CMaps does not contain + slashes. + 2012-09-24 Peter Breitenlohner * version.ac (removed): We now maintain dvipdfmx here. diff --git a/Build/source/texk/dvipdfmx/src/tt_cmap.c b/Build/source/texk/dvipdfmx/src/tt_cmap.c index d2edcd48987..9cf95a83430 100644 --- a/Build/source/texk/dvipdfmx/src/tt_cmap.c +++ b/Build/source/texk/dvipdfmx/src/tt_cmap.c @@ -1028,14 +1028,26 @@ otf_create_ToUnicode_stream (const char *font_name, CMap *cmap_add; int cmap_add_id; tt_cmap *ttcmap; + char *normalized_font_name; char *cmap_name; FILE *fp = NULL; sfnt *sfont; long offset = 0; + /* replace slash in map name with dash to make the output cmap name valid, + * happens when XeTeX embeds full font path + * https://sourceforge.net/p/xetex/bugs/52/ + */ + normalized_font_name = NEW(strlen(font_name), char); + strcpy(normalized_font_name, font_name); + for (i = 0; i < strlen(font_name); ++i) { + if (normalized_font_name[i] == '/') + normalized_font_name[i] = '-'; + } + cmap_name = NEW(strlen(font_name)+strlen("-UTF16")+5, char); - sprintf(cmap_name, "%s,%03d-UTF16", font_name, ttc_index); + sprintf(cmap_name, "%s,%03d-UTF16", normalized_font_name, ttc_index); res_id = pdf_findresource("CMap", cmap_name); if (res_id >= 0) { diff --git a/Build/source/texk/xdvipdfmx/ChangeLog b/Build/source/texk/xdvipdfmx/ChangeLog index a3a6f0fd505..bc07a99ee5d 100644 --- a/Build/source/texk/xdvipdfmx/ChangeLog +++ b/Build/source/texk/xdvipdfmx/ChangeLog @@ -1,4 +1,9 @@ -2012-12-11 Khaled Hosnt +2012-12-12 Khaled Hosny + + * src/tt_cmap.c: Make sure CMapName of embedded CMaps does not contain + slashes. + +2012-12-11 Khaled Hosny * src/tt_cmap.c: Fix crash with fonts that has some glyphs without name entries in 'post' table. diff --git a/Build/source/texk/xdvipdfmx/src/tt_cmap.c b/Build/source/texk/xdvipdfmx/src/tt_cmap.c index 1ac02796e43..04e101c100a 100644 --- a/Build/source/texk/xdvipdfmx/src/tt_cmap.c +++ b/Build/source/texk/xdvipdfmx/src/tt_cmap.c @@ -1079,6 +1079,7 @@ otf_create_ToUnicode_stream (const char *font_name, CMap *cmap_add; int cmap_add_id; tt_cmap *ttcmap; + char *normalized_font_name; char *cmap_name; FILE *fp = NULL; sfnt *sfont; @@ -1086,8 +1087,19 @@ otf_create_ToUnicode_stream (const char *font_name, struct tt_post_table *ttpost = NULL; int i; + /* replace slash in map name with dash to make the output cmap name valid, + * happens when XeTeX embeds full font path + * https://sourceforge.net/p/xetex/bugs/52/ + */ + normalized_font_name = NEW(strlen(font_name), char); + strcpy(normalized_font_name, font_name); + for (i = 0; i < strlen(font_name); ++i) { + if (normalized_font_name[i] == '/') + normalized_font_name[i] = '-'; + } + cmap_name = NEW(strlen(font_name)+strlen("-UTF16")+5, char); - sprintf(cmap_name, "%s,%03d-UTF16", font_name, ttc_index); + sprintf(cmap_name, "%s,%03d-UTF16", normalized_font_name, ttc_index); res_id = pdf_findresource("CMap", cmap_name); if (res_id >= 0) { -- cgit v1.2.3