summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/tt_cmap.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-07-23 14:48:04 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2014-07-23 14:48:04 +0000
commit858d2c9bc2f38514b4e7e4ab15d64291bd4e2e85 (patch)
treed6b28d9c4ab7c643e01d97fc60b1ce473c1d664d /Build/source/texk/dvipdfm-x/tt_cmap.c
parentf8ea78ef6977b4465f488666aa51d7de88c65c6e (diff)
Support CID-keyed OpenType fonts in xdvipdfmx (from Jiang Jiang)
git-svn-id: svn://tug.org/texlive/trunk@34700 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/tt_cmap.c')
-rw-r--r--Build/source/texk/dvipdfm-x/tt_cmap.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c
index aa49979be6c..a2e8e21f679 100644
--- a/Build/source/texk/dvipdfm-x/tt_cmap.c
+++ b/Build/source/texk/dvipdfm-x/tt_cmap.c
@@ -55,6 +55,10 @@
#include "tt_cmap.h"
+#ifdef XETEX
+#include FT_CID_H
+#endif
+
#define VERBOSE_LEVEL_MIN 0
static int verbose = 0;
void
@@ -947,6 +951,16 @@ handle_subst_glyphs (CMap *cmap,
return count;
}
+unsigned int
+gid_to_cid(sfnt *sfont, USHORT gid)
+{
+ unsigned int cid = 0;
+#ifdef XETEX
+ FT_Get_CID_From_Glyph_Index(sfont->ft_face, gid, &cid);
+#endif
+ return cid ? cid : gid;
+}
+
static pdf_obj *
create_ToUnicode_cmap4 (struct cmap4 *map,
const char *cmap_name, CMap *cmap_add,
@@ -985,10 +999,11 @@ create_ToUnicode_cmap4 (struct cmap4 *map,
map->idDelta[i]) & 0xffff;
}
if (is_used_char2(used_glyphs_copy, gid)) {
+ unsigned int cid = gid_to_cid(sfont, gid);
count++;
- wbuf[0] = (gid >> 8) & 0xff;
- wbuf[1] = (gid & 0xff);
+ wbuf[0] = (cid >> 8) & 0xff;
+ wbuf[1] = (cid & 0xff);
wbuf[2] = (ch >> 8) & 0xff;
wbuf[3] = ch & 0xff;
@@ -1057,9 +1072,10 @@ create_ToUnicode_cmap12 (struct cmap12 *map,
d = ch - map->groups[i].startCharCode;
gid = (USHORT) ((map->groups[i].startGlyphID + d) & 0xffff);
if (is_used_char2(used_glyphs_copy, gid)) {
+ unsigned int cid = gid_to_cid(sfont, gid);
count++;
- wbuf[0] = (gid >> 8) & 0xff;
- wbuf[1] = (gid & 0xff);
+ wbuf[0] = (cid >> 8) & 0xff;
+ wbuf[1] = (cid & 0xff);
len = UC_sput_UTF16BE((long)ch, &p, wbuf+WBUF_SIZE);
CMap_add_bfchar(cmap, wbuf, 2, wbuf+2, len);