diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-06-21 02:26:45 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-06-21 02:26:45 +0000 |
commit | 7bc7c6ad12be2d2ae1c800398ce0593dad063ef9 (patch) | |
tree | 264b8e1104656044f262e5a9273b50d56fc2f254 /Build/source/texk/dvipdfm-x | |
parent | 98de3c8419e0e42f940773ac798df9ae69ef237d (diff) |
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
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/tt_cmap.c | 28 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/type1c.c | 4 |
3 files changed, 35 insertions, 5 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index dd4b5eef5fd..e7ded141cb1 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,11 @@ +2020-06-21 Shunsaku Hirata <shunsaku.hirata74@gmail.com> + + * tt_cmap.c: Lower priority for Soft-hyphen U+00AD when + generating ToUnicode CMap. + * tt_cmap.c, type1c.c: Cause an error when "CFF " table is not + found. (Possibly due to variable font which uses unsupported + "CFF2" table) + 2020-06-09 Hironobu Yamashita <h.y.acetaminophen@gmail.com> * pdfdev.c: Another workaround for fake-bold issue. 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; diff --git a/Build/source/texk/dvipdfm-x/type1c.c b/Build/source/texk/dvipdfm-x/type1c.c index fb45f9c9422..b7619af6138 100644 --- a/Build/source/texk/dvipdfm-x/type1c.c +++ b/Build/source/texk/dvipdfm-x/type1c.c @@ -94,7 +94,7 @@ pdf_font_open_type1c (pdf_font *font) offset = sfnt_find_table_pos(sfont, "CFF "); if (offset < 1) { - ERROR("No \"CFF \" table found; not a CFF/OpenType font (10)?"); + ERROR("No \"CFF \" table found; not a CFF/OpenType font (or variable font?) (10)?"); } cffont = cff_open(sfont->stream, offset, 0); @@ -296,7 +296,7 @@ pdf_font_load_type1c (pdf_font *font) } if (sfont->type != SFNT_TYPE_POSTSCRIPT || (offset = sfnt_find_table_pos(sfont, "CFF ")) == 0) { - ERROR("Not a CFF/OpenType font (11)?"); + ERROR("Not a CFF/OpenType font (or variable font?) (11)?"); } cffont = cff_open(fp, offset, 0); |