diff options
author | Jjgod Jiang <gzjjgod@gmail.com> | 2014-08-04 07:29:06 +0000 |
---|---|---|
committer | Jjgod Jiang <gzjjgod@gmail.com> | 2014-08-04 07:29:06 +0000 |
commit | e93685e85b3f0bff2eb571e79d77dccddd1cb2ed (patch) | |
tree | 67a4291f5b96c2222c138129a1d1148d7ef5a89d /Build | |
parent | cee6575f0e755c4c15ff886a180e489545cb86ac (diff) |
Fix ToUnicode stream creation for non-subst glyphs
non-subst glyphs generated with Unicode -> CID CMap are now properly
handled by storing the correct GID used and match them with the CMAP
in the fonts.
subst glyphs (the ones when OpenType features have been applied) can
not be found because they are not directly accessible through CMAP.
git-svn-id: svn://tug.org/texlive/trunk@34830 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cff.c | 15 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cff.h | 1 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfdev.c | 20 |
4 files changed, 26 insertions, 14 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 1504839cfa5..77fb6a8fdf5 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -3,6 +3,10 @@ * tt_cmap.c (sfnt_get_glyphname, handle_subst_glyphs): Fix error on glyph name lookup. + * cff.c (cff_glyph_lookup), pdfdev.c (pdf_dev_set_string): Correctly + handles the dvi file when Unicode to CID mapping file is specified, + where pdf_dev_set_string() got string of cids instead of glyphs. + 2014-08-03 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * pdfobj.c: Fix a typo in check_for_pdf(). diff --git a/Build/source/texk/dvipdfm-x/cff.c b/Build/source/texk/dvipdfm-x/cff.c index 596b1cc4848..f122044b921 100644 --- a/Build/source/texk/dvipdfm-x/cff.c +++ b/Build/source/texk/dvipdfm-x/cff.c @@ -1054,23 +1054,24 @@ card16 cff_glyph_lookup (cff_font *cff, const char *glyph) card16 cff_charsets_lookup (cff_font *cff, card16 cid) { - card16 gid = 0; - cff_charsets *charset; - card16 i; - if (cff->flag & (CHARSETS_ISOADOBE|CHARSETS_EXPERT|CHARSETS_EXPSUB)) { ERROR("Predefined CFF charsets not supported yet"); } else if (cff->charsets == NULL) { ERROR("Charsets data not available"); } + return cff_charsets_lookup_gid(cff->charsets, cid); +} + +card16 cff_charsets_lookup_gid (cff_charsets *charset, card16 cid) +{ + card16 gid = 0; + card16 i; + if (cid == 0) { return 0; /* GID 0 (.notdef) */ } - charset = cff->charsets; - - gid = 0; switch (charset->format) { case 0: for (i = 0; i <charset->num_entries; i++) { diff --git a/Build/source/texk/dvipdfm-x/cff.h b/Build/source/texk/dvipdfm-x/cff.h index 50d019df746..4339d02ab85 100644 --- a/Build/source/texk/dvipdfm-x/cff.h +++ b/Build/source/texk/dvipdfm-x/cff.h @@ -121,6 +121,7 @@ extern card16 cff_glyph_lookup (cff_font *cff, const char *glyph); extern char* cff_get_glyphname (cff_font *cff, card16 gid); /* Returns GID of glyph with SID/CID "cid" */ extern card16 cff_charsets_lookup (cff_font *cff, card16 cid); +extern card16 cff_charsets_lookup_gid (cff_charsets *charset, card16 cid); extern void cff_release_charsets (cff_charsets *charset); /* Returns SID or CID */ extern card16 cff_charsets_lookup_inverse (cff_font *cff, card16 gid); diff --git a/Build/source/texk/dvipdfm-x/pdfdev.c b/Build/source/texk/dvipdfm-x/pdfdev.c index 6c2d1c5b4f3..2819a3e79af 100644 --- a/Build/source/texk/dvipdfm-x/pdfdev.c +++ b/Build/source/texk/dvipdfm-x/pdfdev.c @@ -1158,19 +1158,25 @@ pdf_dev_set_string (spt_t xpos, spt_t ypos, length = instr_len; if (font->format == PDF_FONTTYPE_COMPOSITE) { - if (real_font->used_glyphs != NULL) { - for (i = 0; i < length; i += 2) - add_to_used_chars2(real_font->used_glyphs, - (unsigned short) (str_ptr[i] << 8)|str_ptr[i+1]); + if (real_font->used_glyphs != NULL && ctype == -1) { + for (i = 0; i < length; i += 2) { + unsigned short gid = (str_ptr[i] << 8) | str_ptr[i + 1]; + add_to_used_chars2(real_font->used_glyphs, gid); + } } if (handle_multibyte_string(font, &str_ptr, &length, ctype) < 0) { ERROR("Error in converting input string..."); return; } if (real_font->used_chars != NULL) { - for (i = 0; i < length; i += 2) - add_to_used_chars2(real_font->used_chars, - (unsigned short) (str_ptr[i] << 8)|str_ptr[i+1]); + for (i = 0; i < length; i += 2) { + unsigned short cid = (str_ptr[i] << 8) | str_ptr[i + 1]; + if (ctype == 2 && font->cff_charsets) { + unsigned short gid = cff_charsets_lookup_gid(font->cff_charsets, cid); + add_to_used_chars2(real_font->used_glyphs, gid); + } + add_to_used_chars2(real_font->used_chars, cid); + } } } else { if (real_font->used_chars != NULL) { |