* Sync up to trunk HEAD (r62502).
[reactos.git] / lib / 3rdparty / freetype / src / pcf / pcfdrivr.c
index df25a64..748cbca 100644 (file)
@@ -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;
   }