Fix Savannah bug #27987. * src/cff/cffobjs.c (remove_subset_prefix): New function. (cff_face_init): Use it to adjust `cffface->family_name'.
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
diff --git a/ChangeLog b/ChangeLog
index 5887202..f0bb07a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-21 Bram Tassyns <bramt@enfocus.be>
+
+ 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 <wl@gnu.org>
TrueType: Make FreeType ignore maxSizeOfInstructions in `maxp'.
@@ -16,7 +23,7 @@
2010-05-18 Hongbo Ni <hongbo@njstar.com>
- Apply patch #7196.
+ Apply Savannah patch #7196.
* src/cff/cffgload.c (cff_slot_load): Prevent crash if CFF subfont
index is out of range.
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 6a2b8c8..4dc78bc 100644
--- 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 */
@@ -678,6 +713,8 @@
char* family_name = NULL;
+ remove_subset_prefix( cffface->family_name );
+
if ( dict->family_name )
{
family_name = cff_index_get_sid_string( cff,