From 7bc7c6ad12be2d2ae1c800398ce0593dad063ef9 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 21 Jun 2020 02:26:45 +0000 Subject: Lower priority of Soft-hyphen when generating ToUnicode. Show an error when "CFF " table could not be found for a PS OpenType font. (S. Hirata) git-svn-id: svn://tug.org/texlive/trunk@55615 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/tt_cmap.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Build/source/texk/dvipdfm-x/tt_cmap.c') diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c index 539024ed6e5..cff28f2b690 100644 --- a/Build/source/texk/dvipdfm-x/tt_cmap.c +++ b/Build/source/texk/dvipdfm-x/tt_cmap.c @@ -705,6 +705,7 @@ create_GIDToCIDMap (uint16_t *GIDToCIDMap, uint16_t num_glyphs, cff_font *cffont return; } +/* Soft-hyphen (U+00AD) to lower its priority... added here for convenience */ static int is_PUA_or_presentation (unsigned int uni) { /* Some of CJK Radicals Supplement and Kangxi Radicals @@ -714,7 +715,8 @@ static int is_PUA_or_presentation (unsigned int uni) return ((uni >= 0x2E80 && uni <= 0x2EF3) || (uni >= 0x2F00 && uni <= 0x2FD5) || (uni >= 0xE000 && uni <= 0xF8FF) || (uni >= 0xFB00 && uni <= 0xFB4F) || (uni >= 0xF900 && uni <= 0xFAFF) || (uni >= 0x2F800 && uni <= 0x2FA1F) || - (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD)); + (uni >= 0xF0000 && uni <= 0xFFFFD) || (uni >= 0x100000 && uni <= 0x10FFFD) || + (uni == 0x00AD)); } static char * @@ -937,6 +939,10 @@ create_ToUnicode_cmap (tt_cmap *ttcmap, if (sfont->type == SFNT_TYPE_POSTSCRIPT) { ULONG offset; offset = sfnt_find_table_pos(sfont, "CFF "); + /* "CFF " table must exist here. Just abort... */ + if (offset == 0) { + ERROR("\"CFF \" table not found. Must be found before... Can't continue."); + } cffont = cff_open(sfont->stream, offset, 0); cff_read_charsets(cffont); } @@ -1410,7 +1416,16 @@ otf_load_Unicode_CMap (const char *map_name, int ttc_index, /* 0 for non-TTC fon cff_font *cffont; card16 gid; - offset = sfnt_find_table_pos(sfont, "CFF "); + offset = sfnt_find_table_pos(sfont, "CFF "); + /* Possibly "CFF2" table for variable font: not supported. */ + if (offset == 0) { + WARN("PS OpenType but no \"CFF \" table.. Maybe variable font? (not supported)"); + RELEASE(cmap_name); + RELEASE(GIDToCIDMap); + sfnt_close(sfont); + DPXFCLOSE(fp); + return -1; + } cffont = cff_open(sfont->stream, offset, 0); if (!cffont) { RELEASE(cmap_name); @@ -1682,7 +1697,14 @@ otf_try_load_GID_to_CID_map (const char *map_name, int ttc_index, int wmode) num_glyphs = (card16) maxp->numGlyphs; RELEASE(maxp); - offset = sfnt_find_table_pos(sfont, "CFF "); + offset = sfnt_find_table_pos(sfont, "CFF "); + if (offset == 0) { + WARN("PS OpenType but no \"CFF \" table.. Maybe variable font? (not supported)"); + RELEASE(cmap_name); + sfnt_close(sfont); + DPXFCLOSE(fp); + return -1; + } cffont = cff_open(sfont->stream, offset, 0); if (cffont && cffont->flag & FONTTYPE_CIDFONT) { CMap *cmap; -- cgit v1.2.3