Fix Savannah bug #30373. Too serious check of errors by `FT_CMap_New' since 2010-07-04 is fixed. Reported by Tor Andersson. * include/freetype/fterrdef.h (PSnames_Err_No_Unicode_Glyph_Name): New error code to indicate the Unicode charmap synthesis failed because no Unicode glyph name is found. * src/psnames/psmodule.c (ps_unicodes_init): Return PSnames_Err_No_Unicode_Glyph_Name when no Unicode glyph name is found in the font. * src/cff/cffcmap.c (cff_cmap_unicode_init): Return CFF_Err_No_Unicode_Glyph_Name when no SID is available. * src/type1/t1objs.c (T1_Face_Init): Proceed if `FT_CMap_New' is failed by the lack of Unicode glyph name. * src/type42/t42objs.c (T42_Face_Init): Ditto. * src/cff/cffobjs.c (cff_face_init): Ditto.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/ChangeLog b/ChangeLog
index 75c7f05..7e313a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2010-07-09 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ Fix Savannah bug #30373.
+ Too serious check of errors by `FT_CMap_New' since 2010-07-04
+ is fixed. Reported by Tor Andersson.
+
+ * include/freetype/fterrdef.h
+ (PSnames_Err_No_Unicode_Glyph_Name): New error code to
+ indicate the Unicode charmap synthesis failed because
+ no Unicode glyph name is found.
+
+ * src/psnames/psmodule.c (ps_unicodes_init): Return
+ PSnames_Err_No_Unicode_Glyph_Name when no Unicode glyph name
+ is found in the font.
+ * src/cff/cffcmap.c (cff_cmap_unicode_init): Return
+ CFF_Err_No_Unicode_Glyph_Name when no SID is available.
+
+ * src/type1/t1objs.c (T1_Face_Init): Proceed if `FT_CMap_New'
+ is failed by the lack of Unicode glyph name.
+ * src/type42/t42objs.c (T42_Face_Init): Ditto.
+ * src/cff/cffobjs.c (cff_face_init): Ditto.
+
2010-07-09 Ken Sharp <ken.sharp@artifex.com>
Make ftraster.c compile in stand-alone mode with MSVC compiler.
diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h
index ceda1a9..bf52220 100644
--- a/include/freetype/fterrdef.h
+++ b/include/freetype/fterrdef.h
@@ -211,6 +211,9 @@
"argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2, \
"ignore" )
+ FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \
+ "no Unicode glyph name found" )
+
/* BDF errors */
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 6a98907..1298371 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -143,8 +143,9 @@
/* can't build Unicode map for CID-keyed font */
+ /* because we don't know glyph names. */
if ( !charset->sids )
- return CFF_Err_Invalid_Argument;
+ return CFF_Err_No_Unicode_Glyph_Name;
return psnames->unicodes_init( memory,
unicodes,
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 3d50dde..334ec59 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -899,7 +899,7 @@
error = FT_CMap_New( &FT_CFF_CMAP_UNICODE_CLASS_REC_GET, NULL,
&cmaprec, NULL );
- if ( error )
+ if ( error && FT_Err_No_Unicode_Glyph_Name != error )
goto Exit;
/* if no Unicode charmap was previously selected, select this one */
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index fb3b29c..7528696 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -366,9 +366,10 @@
if ( count == 0 )
{
+ /* No unicode chars here! */
FT_FREE( table->maps );
if ( !error )
- error = PSnames_Err_Invalid_Argument; /* No unicode chars here! */
+ error = PSnames_Err_No_Unicode_Glyph_Name;
}
else
{
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 1183b42..52df90c 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_No_Unicode_Glyph_Name != 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..00b5c1a 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_No_Unicode_Glyph_Name != error )
goto Exit;
/* now, generate an Adobe Standard encoding when appropriate */