Fix Savannah bug #27987.

* src/cff/cffobjs.c (remove_subset_prefix): New function.
(cff_face_init): Use it to adjust `cffface->family_name'.
This commit is contained in:
Bram Tassyns 2010-05-21 10:14:58 +02:00 committed by Werner Lemberg
parent 6da023d1ff
commit d7cc8f499a
2 changed files with 45 additions and 1 deletions

View File

@ -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.

View File

@ -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,