Tue 10 Nov 2009 09:02:50 AM UTC, original submission:
Remove the style_name from the end of the family_name when generating the family_name from the fontname for pure cff fonts.
cffobjs.c, 763:
...
if ( !family && fullp )
{
/* The full name begins with the same characters as the */
/* family name, with spaces and dashes removed. In this */
/* case, the remaining string in `fullp' will be used as */
/* the style name. */
style_name = cff_strcpy( memory, fullp );
}
...
=>
...
if ( !family && fullp )
{
/* The full name begins with the same characters as the */
/* family name, with spaces and dashes removed. In this */
/* case, the remaining string in `fullp' will be used as */
/* the style name. */
style_name = cff_strcpy( memory, fullp );
/* remove the style part from the family name (if present) */
remove_style( cffface->family_name, style_name );
}
with:
/* remove the style part from the family name (if present) */
void
remove_style( FT_String* family_name,
const FT_String* style_name )
{
FT_Int index = 0;
FT_Int32 family_name_length, style_name_length;
family_name_length = strlen( family_name );
style_name_length = strlen( style_name );
if ( family_name_length > style_name_length )
{
for ( index = 1; index <= style_name_length; ++index )
{
if ( family_name[family_name_length-index] !=
style_name[style_name_length-index] )
{
break;
}
}
if ( index > style_name_length )
{
// family_name ends with style_name, remove it
index = family_name_length - style_name_length -1;
// also remove special characters between real family name and style
while ( index > 0
&& ( family_name[index] == '-'
|| family_name[index] == ' '
|| family_name[index] == '_'
|| family_name[index] == '+' ) )
{
--index;
}
if ( index > 0 )
{
family_name[index+1] = 0;
}
}
}
}
...
|