diff options
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/tt_table.c | 23 |
2 files changed, 23 insertions, 5 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index e6562b818e1..55c4812e50a 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2019-03-05 Clerk Ma <maqiyuan130324@vip.qq.com> + + * tt_table.c: Fix 'null character(s)' warning which caused by + fonts like Roboto (Android) or YuMincho (Windows 10). + 2019-02-25 Hironobu Yamashita <h.y.acetaminophen@gmail.com> * tt_cmap.c (is_PUA_or_presentation): diff --git a/Build/source/texk/dvipdfm-x/tt_table.c b/Build/source/texk/dvipdfm-x/tt_table.c index 45f68ee2a88..fdd0c3ce393 100644 --- a/Build/source/texk/dvipdfm-x/tt_table.c +++ b/Build/source/texk/dvipdfm-x/tt_table.c @@ -432,9 +432,12 @@ tt_get_name (sfnt *sfont, char *dest, USHORT destlen, USHORT length = 0; USHORT num_names, string_offset; ULONG name_offset; - int i; + int i, j; + int is_utf16_be; name_offset = sfnt_locate_table (sfont, "name"); + is_utf16_be = (plat_id == 3) && (enco_id == 1) && + (lang_id == 0x0409u) && (name_id == 6); if (sfnt_get_ushort(sfont)) ERROR ("Expecting zero"); @@ -453,13 +456,23 @@ tt_get_name (sfnt *sfont, char *dest, USHORT destlen, offset = sfnt_get_ushort(sfont); /* language ID value 0xffffu for `accept any language ID' */ if ((p_id == plat_id) && (e_id == enco_id) && - (lang_id == 0xffffu || l_id == lang_id) && (n_id == name_id)) { + (lang_id == 0xffffu || l_id == lang_id) && (n_id == name_id)) { + if (is_utf16_be) { + length /= 2; + } if (length > destlen - 1) { - WARN ("Name string too long (%u), truncating to %u", length, destlen); - length = destlen - 1; + WARN ("Name string too long (%u), truncating to %u", length, destlen); + length = destlen - 1; } sfnt_seek_set (sfont, name_offset+string_offset+offset); - sfnt_read((unsigned char*)dest, length, sfont); + if (is_utf16_be) { + for (j=0;j<length;j++) { + dest[j] = (unsigned char)(sfnt_get_ushort(sfont) & 0x00FF); + } + } + else { + sfnt_read((unsigned char*)dest, length, sfont); + } dest[length] = '\0'; break; } |