diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/font/tounicode.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/tounicode.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.c b/Build/source/texk/web2c/luatexdir/font/tounicode.c index f0449aff957..32210600c21 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.c +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.c @@ -287,6 +287,7 @@ static void set_glyph_unicode(char *s, glyph_unicode_entry * gp) } } +/* static void set_cid_glyph_unicode(long index, glyph_unicode_entry * gp, internal_font_number f) { char *s; @@ -295,13 +296,14 @@ static void set_cid_glyph_unicode(long index, glyph_unicode_entry * gp, internal gp->code = UNI_EXTRA_STRING; gp->unicode_seq = xstrdup(s); } else { - /*tex No fall back as we're providing them ourselves. */ + // No fall back as we're providing them ourselves. } } else { - /*tex Fall back. */ + // Fall back gp->code = index; } } +*/ int write_tounicode(PDF pdf, char **glyph_names, char *name) { @@ -470,9 +472,10 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f) static int range_size[65537]; static glyph_unicode_entry gtab[65537]; int objnum; - int i, j, k; + int i, j, k, tu; int bfchar_count, bfrange_count, subrange_count; char *buf; + char *s; buf = xmalloc((unsigned) (strlen(fo->fd->fontname) + 8)); sprintf(buf, "%s-%s", (fo->fd->subset_tag != NULL ? fo->fd->subset_tag : "UCS"), fo->fd->fontname); objnum = pdf_create_obj(pdf, obj_type_others, 0); @@ -514,7 +517,36 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f) if (quick_char_exists(k, i) && char_used(k, i)) { j = char_index(k, i); if (gtab[j].code == UNI_UNDEF) { + /* set_cid_glyph_unicode(i, >ab[j], f); + */ + tu = 0; + /*tex + First look in the instance (new). Ff this fails + us (context) it will go away or become an option. + */ + if (font_tounicode(k)) { + tu = 1; /*tex no fallback to index */ + if ((s = get_charinfo_tounicode(char_info(k, (int) i))) != NULL) { + gtab[j].code = UNI_EXTRA_STRING; + gtab[j].unicode_seq = xstrdup(s); + } + } + /*tex + Then look in the parent (was default, so one can + still be sparse). + */ + if (k != f && gtab[j].code == UNI_UNDEF && font_tounicode(f)) { + tu = 1; /*tex no fallback to index */ + if ((s = get_charinfo_tounicode(char_info(f, (int) i))) != NULL) { + gtab[j].code = UNI_EXTRA_STRING; + gtab[j].unicode_seq = xstrdup(s); + } + } + if (! tu) { + /*tex No tonunicode so we map onto index. */ + gtab[j].code = i; + } } } } |