Skip to content
Snippets Groups Projects
Commit 6ccc24ee authored by Luigi Scarso's avatar Luigi Scarso
Browse files

possible patch for tounicode (but needs testing in context) (HH)

parent 4e082a46
Branches
Tags
No related merge requests found
......@@ -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, &gtab[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;
}
}
}
}
......
#define luatex_svn_revision 6999
#define luatex_svn_revision 7000
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment