shithub: freetype+ttf2subf

Download patch

ref: f24d0793f1a837e869cfcd1a06275a06dae4bd1c
parent: 02c0e526b2d07d09c2880b3b4b22e945f6d6a596
author: Werner Lemberg <[email protected]>
date: Sat Feb 11 04:37:46 EST 2012

Clean up `generic' fields.

* include/freetype/internal/ftobjs.h (FT_ModuleRec, FT_LibraryRec):
Remove `generic' field since users can't access it.

* src/base/ftobjs.c (FT_Done_GlyphSlot): Call `generic.finalizer' as
advertised in the documentation of FT_Generic.
(Destroy_Module, FT_Done_Library): Updated to changes in `ftobjs.h'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-02-11  Werner Lemberg  <[email protected]>
+
+	Clean up `generic' fields.
+
+	* include/freetype/internal/ftobjs.h (FT_ModuleRec, FT_LibraryRec):
+	Remove `generic' field since users can't access it.
+
+	* src/base/ftobjs.c (FT_Done_GlyphSlot): Call `generic.finalizer' as
+	advertised in the documentation of FT_Generic.
+	(Destroy_Module, FT_Done_Library): Updated to changes in `ftobjs.h'.
+
 2012-02-07  Werner Lemberg  <[email protected]>
 
 	[autofit] Harmonize function arguments.
--- a/include/freetype/fttypes.h
+++ b/include/freetype/fttypes.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType simple types definitions (specification only).              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by                   */
+/*  Copyright 1996-2002, 2004, 2006-2009, 2012 by                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -434,7 +434,7 @@
   /*    variety of FreeType core objects.  For example, a text layout API  */
   /*    might want to associate a glyph cache to a given size object.      */
   /*                                                                       */
-  /*    Most FreeType object contains a `generic' field, of type           */
+  /*    Some FreeType object contains a `generic' field, of type           */
   /*    FT_Generic, which usage is left to client applications and font    */
   /*    servers.                                                           */
   /*                                                                       */
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by       */
+/*  Copyright 1996-2006, 2008, 2010, 2012 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -436,19 +436,16 @@
   /*                                                                       */
   /*    memory  :: A handle to the memory manager.                         */
   /*                                                                       */
-  /*    generic :: A generic structure for user-level extensibility (?).   */
-  /*                                                                       */
   typedef struct  FT_ModuleRec_
   {
     FT_Module_Class*  clazz;
     FT_Library        library;
     FT_Memory         memory;
-    FT_Generic        generic;
 
   } FT_ModuleRec;
 
 
-  /* typecast an object to a FT_Module */
+  /* typecast an object to an FT_Module */
 #define FT_MODULE( x )          ((FT_Module)( x ))
 #define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz
 #define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library
@@ -776,9 +773,6 @@
   /*    memory           :: The library's memory object.  Manages memory   */
   /*                        allocation.                                    */
   /*                                                                       */
-  /*    generic          :: Client data variable.  Used to extend the      */
-  /*                        Library class by higher levels and clients.    */
-  /*                                                                       */
   /*    version_major    :: The major version number of the library.       */
   /*                                                                       */
   /*    version_minor    :: The minor version number of the library.       */
@@ -837,8 +831,6 @@
   typedef struct  FT_LibraryRec_
   {
     FT_Memory          memory;           /* library's memory manager */
-
-    FT_Generic         generic;
 
     FT_Int             version_major;
     FT_Int             version_minor;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (body).                            */
 /*                                                                         */
-/*  Copyright 1996-2011 by                                                 */
+/*  Copyright 1996-2012 by                                                 */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -445,6 +445,10 @@
           else
             prev->next = cur->next;
 
+          /* finalize client-specific data */
+          if ( slot->generic.finalizer )
+            slot->generic.finalizer( slot );
+
           ft_glyphslot_done( slot );
           FT_FREE( slot );
           break;
@@ -4085,10 +4089,10 @@
   /*    all child faces.                                                   */
   /*                                                                       */
   /* <InOut>                                                               */
-  /*     module :: A handle to the target driver object.                   */
+  /*    module :: A handle to the target driver object.                    */
   /*                                                                       */
   /* <Note>                                                                */
-  /*     The driver _must_ be LOCKED!                                      */
+  /*    The driver _must_ be LOCKED!                                       */
   /*                                                                       */
   static void
   Destroy_Module( FT_Module  module )
@@ -4098,10 +4102,6 @@
     FT_Library        library = module->library;
 
 
-    /* finalize client-data - before anything else */
-    if ( module->generic.finalizer )
-      module->generic.finalizer( module );
-
     if ( library && library->auto_hinter == module )
       library->auto_hinter = 0;
 
@@ -4318,6 +4318,7 @@
         FT_Module*  cur     = library->modules;
         FT_Module*  limit   = cur + library->num_modules;
 
+
         for ( ; cur < limit; cur++ )
         {
           if ( cur[0] != module )
@@ -4510,10 +4511,6 @@
       goto Exit;
 
     memory = library->memory;
-
-    /* Discard client-data */
-    if ( library->generic.finalizer )
-      library->generic.finalizer( library );
 
     /*
      * Close all faces in the library.  If we don't do this, we can have