aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/pcf/pcfdrivr.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/pcf/pcfdrivr.c')
-rw-r--r--freetype/src/pcf/pcfdrivr.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/freetype/src/pcf/pcfdrivr.c b/freetype/src/pcf/pcfdrivr.c
index 903d7ee5a..44fb3789c 100644
--- a/freetype/src/pcf/pcfdrivr.c
+++ b/freetype/src/pcf/pcfdrivr.c
@@ -218,25 +218,24 @@ THE SOFTWARE.
FT_FREE( face->metrics );
/* free properties */
+ if ( face->properties )
{
- PCF_Property prop;
- FT_Int i;
+ FT_Int i;
- if ( face->properties )
+ for ( i = 0; i < face->nprops; i++ )
{
- for ( i = 0; i < face->nprops; i++ )
+ PCF_Property prop = &face->properties[i];
+
+
+ if ( prop )
{
- prop = &face->properties[i];
-
- if ( prop )
- {
- FT_FREE( prop->name );
- if ( prop->isString )
- FT_FREE( prop->value.atom );
- }
+ FT_FREE( prop->name );
+ if ( prop->isString )
+ FT_FREE( prop->value.atom );
}
}
+
FT_FREE( face->properties );
}
@@ -264,11 +263,10 @@ THE SOFTWARE.
FT_Parameter* params )
{
PCF_Face face = (PCF_Face)pcfface;
- FT_Error error = FT_Err_Ok;
+ FT_Error error;
FT_UNUSED( num_params );
FT_UNUSED( params );
- FT_UNUSED( face_index );
FT_TRACE2(( "PCF driver\n" ));
@@ -347,6 +345,18 @@ THE SOFTWARE.
#endif
}
+ /* PCF could not have multiple face in single font file.
+ * XXX: non-zero face_index is already invalid argument, but
+ * Type1, Type42 driver has a convention to return
+ * an invalid argument error when the font could be
+ * opened by the specified driver.
+ */
+ if ( face_index > 0 ) {
+ FT_ERROR(( "PCF_Face_Init: invalid face index\n" ));
+ PCF_Face_Done( pcfface );
+ return FT_THROW( Invalid_Argument );
+ }
+
/* set up charmap */
{
FT_String *charset_registry = face->charset_registry;
@@ -482,7 +492,7 @@ THE SOFTWARE.
FT_UNUSED( load_flags );
- FT_TRACE4(( "load_glyph %d ---", glyph_index ));
+ FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index ));
if ( !face || glyph_index >= (FT_UInt)face->root.num_glyphs )
{
@@ -576,8 +586,6 @@ THE SOFTWARE.
( face->accel.fontAscent +
face->accel.fontDescent ) << 6 );
- FT_TRACE4(( " --- ok\n" ));
-
Exit:
return error;
}