[DVIPDFMx] Proposed patch for "SEAC" bug
keiichirou shikano
k16.shikano at gmail.com
Tue Aug 21 16:59:47 KST 2012
Hi,
>> version from behind our company's proxy server.) However, I think the
>> patch will be helpful for the latest version.
My first patch works for dvipdfmx but it turns out to FAIL for
xdvipdfmx with fontspec package, since it invokes the same
cff_get_sid() function, which I have modified. Sorry to bother
xdvipdfmx users.
http://w32tex.org/ChangeLog (See [2012/06/24])
My intention was to bypass searching 'String INDEX' for SEAC glyphs. I
had second thought about it and now I think it's more sensible to
equip another function cff_get_seac_sid(), rather than having changed
cff_get_sid() itself, and use the new one only from SEAC routine.
I'm not sure whether it's the best, or even the right way, so it needs
a closer look from someone includeing xdvipdfmx team. As far as I
tested xdvipdfmx in texlive-20120701, it doesn't seem to disturb
xelatex + fontspec.
diff --git a/src/cff.c b/src/cff.c
index 99f0b4f..c358560 100755
--- a/src/cff.c
+++ b/src/cff.c
@@ -508,7 +508,7 @@ long cff_get_sid (cff_font *cff, const char *str)
/* I search String INDEX first. */
if (cff && cff->string) {
cff_index *idx = cff->string;
- for (i = 0; i < idx->count - CFF_STDSTR_MAX; i++) {
+ for (i = 0; i < idx->count; i++) {
if (strlen(str) == (idx->offset)[i+1] - (idx->offset)[i] &&
!memcmp(str, (idx->data)+(idx->offset)[i]-1, strlen(str)))
return (i + CFF_STDSTR_MAX);
@@ -523,6 +523,21 @@ long cff_get_sid (cff_font *cff, const char *str)
return -1;
}
+long cff_get_seac_sid (cff_font *cff, const char *str)
+{
+ card16 i;
+
+ if (!cff || !str)
+ return -1;
+
+ for (i = 0; i < CFF_STDSTR_MAX; i++) {
+ if (!strcmp(str, cff_stdstr[i]))
+ return i;
+ }
+
+ return -1;
+}
+
int cff_match_string (cff_font *cff, const char *str, s_SID sid)
{
card16 i;
diff --git a/src/cff.h b/src/cff.h
index d15de03..d682cec 100755
--- a/src/cff.h
+++ b/src/cff.h
@@ -137,6 +137,7 @@ extern long cff_read_private (cff_font *cff);
extern int cff_match_string (cff_font *cff, const char *str, s_SID sid);
extern char *cff_get_string (cff_font *cff, s_SID id);
extern long cff_get_sid (cff_font *cff, const char *str);
+extern long cff_get_seac_sid (cff_font *cff, const char *str);
extern s_SID cff_add_string (cff_font *cff, const char *str, int unique);
extern void cff_update_string (cff_font *cff);
diff --git a/src/type1.c b/src/type1.c
index 6cb7bab..7aa85c6 100755
--- a/src/type1.c
+++ b/src/type1.c
@@ -738,7 +738,7 @@ pdf_font_load_type1 (pdf_font *font)
if (verbose > 2)
MESG("/%s", achar_name);
GIDMap[num_glyphs++] = achar_gid;
- charset->data.glyphs[charset->num_entries] = cff_get_sid(cffont,
achar_name);
+ charset->data.glyphs[charset->num_entries] =
cff_get_seac_sid(cffont, achar_name);
charset->num_entries += 1;
}
@@ -750,7 +750,7 @@ pdf_font_load_type1 (pdf_font *font)
if (verbose > 2)
MESG("/%s", bchar_name);
GIDMap[num_glyphs++] = bchar_gid;
- charset->data.glyphs[charset->num_entries] = cff_get_sid(cffont,
bchar_name);
+ charset->data.glyphs[charset->num_entries] =
cff_get_seac_sid(cffont, bchar_name);
charset->num_entries += 1;
}
have_seac = 1;
More information about the dvipdfmx
mailing list