Thu 08 Jul 2010 03:28:34 PM UTC, comment #2:
I'm sorry for my introduction of new bug in the commit.
My analysis is following:
1) it is possible that all glyph names in a PS font cannot
be related with Unicode. In the case of font.pfa, maybe
it is designed for mathematical glyphs, the glyph name
"/trianglerightsld" cannot be mapped to any Unicode character
by FT2.
2) Type1 & Type42 drivers tries to synthesize Unicode
charmap for first (as a fallback charmap) from the glyph
name list. The first FT_CMap_New() does such.
This synthesized Unicode charmap is a fallback, so FT2
proceeds to make more natural charmap from its encoding type.
The second FT_CMap_New() does such.
/* first of all, try to synthesize a Unicode charmap */
charmap.platform_id = 3;
charmap.encoding_id = 1;
charmap.encoding = FT_ENCODING_UNICODE;
FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
/* now, generate an Adobe Standard encoding when appropriate */
charmap.platform_id = 7;
clazz = NULL;
switch ( type1->encoding_type )
{
case T1_ENCODING_TYPE_STANDARD:
charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
charmap.encoding_id = TT_ADOBE_ID_STANDARD;
clazz = cmap_classes->standard;
break;
/* snip */
default:
;
}
if ( clazz )
error = FT_CMap_New( clazz, NULL, &charmap, NULL );
#if 0
/* Select default charmap */
if (root->num_charmaps)
root->charmap = root->charmaps[0];
#endif
}
}
Exit:
return error;
}
3) For a PS font including no glyphname that can be mapped
to Unicode, the first FT_CMap_New() returns an error
(PSnames_Err_Invalid_Argument). This is not fatal error,
if the second FT_CMap_New() finishes successfully.
However, if first FT_CMap_New() returns any memory-related
error (new FT_CMap record allocation, extending face->charmaps[],
etc etc), the second FT_CMap_New() should not be invoked
to avoid confusing the error.
I made a mistake which handles this non-fatal error
in first FT_CMap_New() as a fatal error.
Thus, following modification fixes this issue.
Soon I will commit it to GIT repository.
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 1183b42..3f64595 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -499,7 +499,7 @@
charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
- if ( error )
+ if ( error && FT_Err_Invalid_Argument != error )
goto Exit;
/* now, generate an Adobe Standard encoding when appropriate */
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index de88465..97dc8e2 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -335,7 +335,7 @@
charmap.encoding = FT_ENCODING_UNICODE;
error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
- if ( error )
+ if ( error && FT_Err_Invalid_Argument != error )
goto Exit;
/* now, generate an Adobe Standard encoding when appropriate */
(file #20923)
|