ref: c9669a8a632b21cdb772456f5515692df353da58
parent: 75852eda51106579c3b15be83e5ab6b896d54f07
author: suzuki toshiya <[email protected]>
date: Fri Jan 29 21:24:25 EST 2010
[sfnt] Fix memory leaks in previous patch.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-01-29 suzuki toshiya <[email protected]>
+ Fix memory leaks in previous patch.
+
+ * src/sfnt/sfobjs.c (sfnt_load_face): Don't overwrite the strings
+ allocated for face->root.family_name and style_name.
+
+2010-01-29 suzuki toshiya <[email protected]>
+
New parameters for FT_Open_Face() to ignore preferred family names.
Preferred family names should be used for legacy systems that
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -737,29 +737,33 @@
/* Foundation (WPF). This flag has been introduced in version */
/* 1.5 of the OpenType specification (May 2008). */
+ face->root.family_name = NULL;
+ face->root.style_name = NULL;
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
{
- GET_NAME( FONT_FAMILY, &face->root.family_name );
- if ( !face->root.family_name || !ignore_preferred_family )
+ if ( !ignore_preferred_family )
GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
+ if ( !face->root.family_name )
+ GET_NAME( FONT_FAMILY, &face->root.family_name );
- GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
- if ( !face->root.style_name || !ignore_preferred_subfamily )
+ if ( !ignore_preferred_subfamily )
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
+ if ( !face->root.style_name )
+ GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
else
{
GET_NAME( WWS_FAMILY, &face->root.family_name );
+ if ( !face->root.family_name && !ignore_preferred_family )
+ GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_name );
- if ( !face->root.family_name || !ignore_preferred_family )
- GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
+ if ( !face->root.style_name && !ignore_preferred_subfamily )
+ GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
- if ( !face->root.style_name || !ignore_preferred_subfamily )
- GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
}
/* now set up root fields */