diff options
author | Jjgod Jiang <gzjjgod@gmail.com> | 2014-08-04 07:29:07 +0000 |
---|---|---|
committer | Jjgod Jiang <gzjjgod@gmail.com> | 2014-08-04 07:29:07 +0000 |
commit | 9e295194f1137856c64809a484b41306473d7a89 (patch) | |
tree | a0f9a63f20aa60fe06c216a40a1c75dae96551e8 /Build/source/texk/dvipdfm-x/cmap.h | |
parent | e93685e85b3f0bff2eb571e79d77dccddd1cb2ed (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/cmap.h')
-rw-r--r-- | Build/source/texk/dvipdfm-x/cmap.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Build/source/texk/dvipdfm-x/cmap.h b/Build/source/texk/dvipdfm-x/cmap.h index 9b0f6faa345..75c39bd4b47 100644 --- a/Build/source/texk/dvipdfm-x/cmap.h +++ b/Build/source/texk/dvipdfm-x/cmap.h @@ -107,6 +107,8 @@ extern long CMap_decode (CMap *cmap, const unsigned char **inbuf, long *inbytesleft, unsigned char **outbuf, long *outbytesleft); +extern int CMap_reverse_decode(CMap *cmap, CID cid); + extern void CMap_cache_init (void); extern CMap *CMap_cache_get (int id); extern int CMap_cache_find (const char *cmap_name); |