summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/type0.c
diff options
context:
space:
mode:
authorJjgod Jiang <gzjjgod@gmail.com>2014-08-04 07:29:07 +0000
committerJjgod Jiang <gzjjgod@gmail.com>2014-08-04 07:29:07 +0000
commit9e295194f1137856c64809a484b41306473d7a89 (patch)
treea0f9a63f20aa60fe06c216a40a1c75dae96551e8 /Build/source/texk/dvipdfm-x/type0.c
parente93685e85b3f0bff2eb571e79d77dccddd1cb2ed (diff)
Fix ToUnicode with reverse CMap lookup
When dvipdfmx is provided a regular CMap in the following format: <unicode codepoint> cid We can try to utilize the data and do a reverse lookup when all we know is the cids used. Initially, when parsing the cmap specified, we build a reverseMap which maps CID to the first Unicode codepoint it corresponds to. (Which is pretty much the reverse of CMap_decode().) Since this cmap is already parsed when we create the fontmap cache, we can just pass the cmap_id all the way down to otf_create_ToUnicode_stream() and get CMap* back from this cmap_id. Second, we refactor create_ToUnicode_cmap{4, 12}() functions into one create_ToUnicode_cmap() and combine the common code. In the third step, in create_ToUnicode_cmap() we try to see if the font is indeed a CFF font (with CID-keyed), and we do have a cmap, we can use the newly added CMap_reverse_decode() to convert all used cids back to Unicode codepoints. With that mapping information we can successfully create the ToUnicode PDF stream we needed. git-svn-id: svn://tug.org/texlive/trunk@34831 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/type0.c')
-rw-r--r--Build/source/texk/dvipdfm-x/type0.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Build/source/texk/dvipdfm-x/type0.c b/Build/source/texk/dvipdfm-x/type0.c
index 0a768982cac..9015941f20c 100644
--- a/Build/source/texk/dvipdfm-x/type0.c
+++ b/Build/source/texk/dvipdfm-x/type0.c
@@ -93,6 +93,7 @@ struct Type0Font {
CIDFont *descendant; /* Only single descendant is allowed. */
int flags;
int wmode;
+ int cmap_id;
/*
* PDF Font Resource
@@ -116,6 +117,7 @@ Type0Font_init_font_struct (Type0Font *font)
font->used_glyphs = NULL;
font->descendant = NULL;
font->wmode = -1;
+ font->cmap_id = -1;
font->flags = FLAG_NONE;
return;
@@ -161,7 +163,8 @@ Type0Font_create_ToUnicode_stream(Type0Font *font) {
return otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
CIDFont_get_opt_index(cidfont),
- used);
+ used,
+ font->cmap_id);
}
/* Try to load ToUnicode CMap from file system first, if not found fallback to
@@ -466,6 +469,7 @@ Type0Font_cache_find (const char *map_name, int cmap_id, fontmap_opt *fmap_opt)
strcpy(font->encoding, "Identity-H");
}
font->wmode = wmode;
+ font->cmap_id = cmap_id;
/*
* Now we start font dictionary.