diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2014-07-28 16:27:05 +0000 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2014-07-28 16:27:05 +0000 |
commit | 3d78eff486ad745d2fc3fc3e64ad70755c6d095e (patch) | |
tree | e066a0523a7061425e7c1cf1f0ba14424696e3da | |
parent | 82e9e2be5ac97133809374429b0914982d81de1a (diff) |
Support getting glyph names from OpenType/CFF fonts
git-svn-id: svn://tug.org/texlive/trunk@34757 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cff.c | 10 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cff.h | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/tt_cmap.c | 13 |
4 files changed, 29 insertions, 0 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 6f6c4aab614..d31f85cecb3 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -11,6 +11,10 @@ * tt_cmap.c (handle_subst_glyphs): Don't try to added invalid CMap entries (regression from r34718). + * cff.c, cff.h: Add cff_get_glyphname convenience function. + * tt_cmap.c (sfnt_get_glyphname): Support getting glyph names from + OpenType/CFF fonts (regression from r34718). + 2014-07-28 Jiang Jiang <gzjjgod@gmail.com> * cid.c, pdfdev.c: Correct release of retained cff_charsets. diff --git a/Build/source/texk/dvipdfm-x/cff.c b/Build/source/texk/dvipdfm-x/cff.c index 7dd35d44cb0..596b1cc4848 100644 --- a/Build/source/texk/dvipdfm-x/cff.c +++ b/Build/source/texk/dvipdfm-x/cff.c @@ -978,6 +978,16 @@ long cff_pack_charsets (cff_font *cff, card8 *dest, long destlen) return len; } +char* cff_get_glyphname (cff_font *cff, card16 gid) +{ + s_SID sid; + + cff_read_charsets(cff); + + sid = cff_charsets_lookup_inverse(cff, gid); + return cff_get_string(cff, sid); +} + card16 cff_glyph_lookup (cff_font *cff, const char *glyph) { card16 gid; diff --git a/Build/source/texk/dvipdfm-x/cff.h b/Build/source/texk/dvipdfm-x/cff.h index f495b9f2321..50d019df746 100644 --- a/Build/source/texk/dvipdfm-x/cff.h +++ b/Build/source/texk/dvipdfm-x/cff.h @@ -117,6 +117,8 @@ extern long cff_pack_charsets (cff_font *cff, card8 *dest, long destlen); /* Returns GID of PS name "glyph" */ extern card16 cff_glyph_lookup (cff_font *cff, const char *glyph); +/* Return PS name of "gid" */ +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 void cff_release_charsets (cff_charsets *charset); diff --git a/Build/source/texk/dvipdfm-x/tt_cmap.c b/Build/source/texk/dvipdfm-x/tt_cmap.c index c277052efd1..9036b51c899 100644 --- a/Build/source/texk/dvipdfm-x/tt_cmap.c +++ b/Build/source/texk/dvipdfm-x/tt_cmap.c @@ -851,6 +851,19 @@ sfnt_get_glyphname(sfnt *sfont, USHORT gid) { tt_release_post_table(post); } + if (!name) { + unsigned long offset = 0; + cff_font *cffont = NULL; + offset = sfnt_find_table_pos(sfont, "CFF "); + if (offset > 0) { + cffont = cff_open(sfont->stream, offset, 0); + + name = cff_get_glyphname(cffont, gid); + + cff_close(cffont); + } + } + return name; } |