diff options
author | Jjgod Jiang <gzjjgod@gmail.com> | 2015-05-23 23:14:52 +0000 |
---|---|---|
committer | Jjgod Jiang <gzjjgod@gmail.com> | 2015-05-23 23:14:52 +0000 |
commit | c70f4a23171436f9a823305115310c9189db17f8 (patch) | |
tree | e4c2f6c65d277b8f1625922597369a1fdda0ffd0 /Build/source/texk/dvipdfm-x | |
parent | c973ae0433453df8520d8662eccaa8a08700e50e (diff) |
Handle custom Type1 encoding better
git-svn-id: svn://tug.org/texlive/trunk@37492 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvi.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c index 4377894bfac..13ebcb793a8 100644 --- a/Build/source/texk/dvipdfm-x/dvi.c +++ b/Build/source/texk/dvipdfm-x/dvi.c @@ -152,6 +152,7 @@ static struct loaded_font int descent; unsigned unitsPerEm; cff_font *cffont; + int cff_is_standard_encoding; unsigned numGlyphs; int layout_dir; float extend; @@ -970,6 +971,8 @@ dvi_locate_native_font (const char *filename, uint32_t index, if (is_type1) { cff_font *cffont; + char **enc_vec; + int code; fp = DPXFOPEN(filename, DPX_RES_TYPE_T1FONT); if (!fp) @@ -978,11 +981,16 @@ dvi_locate_native_font (const char *filename, uint32_t index, if (!is_pfb(fp)) ERROR("Failed to read Type 1 font \"%s\".", filename); - cffont = t1_load_font(NULL, 0, fp); + enc_vec = NEW(256, char *); + for (code = 0; code <= 0xff; code++) { + enc_vec[code] = NULL; + } + cffont = t1_load_font(enc_vec, 0, fp); if (!cffont) ERROR("Failed to read Type 1 font \"%s\".", filename); loaded_fonts[cur_id].cffont = cffont; + loaded_fonts[cur_id].cff_is_standard_encoding = enc_vec[0] == NULL; if (cff_dict_known(cffont->topdict, "FontBBox")) { loaded_fonts[cur_id].ascent = cff_dict_get(cffont->topdict, "FontBBox", 3); @@ -1665,11 +1673,13 @@ do_glyphs (void) double descent = (double)font->descent; if (font->cffont) { - /* Type1 glyph id is FreeType glyph index + 1. */ - glyph_id += 1; cff_index *cstrings = font->cffont->cstrings; t1_ginfo gm; + /* For standard encoding, Type1 glyph id is FreeType glyph index + 1. */ + if (font->cff_is_standard_encoding) + glyph_id += 1; + t1char_get_metrics(cstrings->data + cstrings->offset[glyph_id] - 1, cstrings->offset[glyph_id + 1] - cstrings->offset[glyph_id], font->cffont->subrs[0], &gm); |