shithub: freetype+ttf2subf

Download patch

ref: b8ca6de3653b5c3d50e9fadc6a1d7b606deffbdb
parent: 603d1218724055f538e2f36d7e74454b1a44cc12
author: suzuki toshiya <[email protected]>
date: Fri Jul 9 07:36:00 EDT 2010

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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2010-07-09  suzuki toshiya  <[email protected]>
+
+	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  <[email protected]>
 
 	Make ftraster.c compile in stand-alone mode with MSVC compiler.
--- 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 */
 
--- 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,
--- 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 */
--- 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
       {
--- 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 */
--- 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 */