ref: d7cc8f499ac27c41c02cfaddd98ee226def63663
parent: 6da023d1ff9b70f78c900774cc5d362af53ad92c
author: Bram Tassyns <[email protected]>
date: Fri May 21 06:14:58 EDT 2010
Fix Savannah bug #27987. * src/cff/cffobjs.c (remove_subset_prefix): New function. (cff_face_init): Use it to adjust `cffface->family_name'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-21 Bram Tassyns <[email protected]>
+
+ Fix Savannah bug #27987.
+
+ * src/cff/cffobjs.c (remove_subset_prefix): New function.
+ (cff_face_init): Use it to adjust `cffface->family_name'.
+
2010-05-20 Werner Lemberg <[email protected]>
TrueType: Make FreeType ignore maxSizeOfInstructions in `maxp'.
@@ -16,7 +23,7 @@
2010-05-18 Hongbo Ni <[email protected]>
- Apply patch #7196.
+ Apply Savannah patch #7196.
* src/cff/cffgload.c (cff_slot_load): Prevent crash if CFF subfont
index is out of range.
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -394,6 +394,41 @@
}
+ /* Strip all subset prefixes of the form `ABCDEF+'. Usually, there */
+ /* is only one, but font names like `APCOOG+JFABTD+FuturaBQ-Bold' */
+ /* have been seen in the wild. */
+
+ static void
+ remove_subset_prefix( FT_String* name )
+ {
+ FT_Int32 idx = 0;
+ FT_Int32 length = strlen( name ) + 1;
+ FT_Bool continue_search = 1;
+
+
+ while ( continue_search )
+ {
+ if ( length >= 7 && name[6] == '+' )
+ {
+ for ( idx = 0; idx < 6; idx++ )
+ {
+ /* ASCII uppercase letters */
+ if ( !( 'A' <= name[idx] && name[idx] <= 'Z' ) )
+ continue_search = 0;
+ }
+
+ if ( continue_search )
+ {
+ for ( idx = 7; idx < length; idx++ )
+ name[idx - 7] = name[idx];
+ }
+ }
+ else
+ continue_search = 0;
+ }
+ }
+
+
FT_LOCAL_DEF( FT_Error )
cff_face_init( FT_Stream stream,
FT_Face cffface, /* CFF_Face */
@@ -677,6 +712,8 @@
char* family = cffface->family_name;
char* family_name = NULL;
+
+ remove_subset_prefix( cffface->family_name );
if ( dict->family_name )
{