shithub: freetype+ttf2subf

Download patch

ref: 86ae11cf8714b4f25ad3187fb7a96914045cfb52
parent: 44005cd35880da283414033883e8ee49ea1a9dd0
author: Werner Lemberg <[email protected]>
date: Tue May 4 12:53:45 EDT 2004

* src/truetype/ttobjs.h, src/truetype/ttobjs.c (tt_face_init,
tt_face_done, tt_size_init, tt_size_done, tt_driver_init,
tt_driver_done): Don't use TT_XXX but FT_XXX arguments which are
typecast to the proper TT_XXX within the function.
Update code accordingly.

* src/truetype/ttdriver.c (Get_Kerning, Set_Char_Sizes,
Set_Pixel_Sizes, Load_Glyph, tt_get_interface): Don't use TT_XXX but
FT_XXX arguments which are typecast to the proper TT_XXX within the
function.
Update code accordingly.
(tt_driver_class): Remove casts.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-05-03  Steve Hartwell  <[email protected]>
+
+	* src/truetype/ttobjs.h, src/truetype/ttobjs.c (tt_face_init,
+	tt_face_done, tt_size_init, tt_size_done, tt_driver_init,
+	tt_driver_done): Don't use TT_XXX but FT_XXX arguments which are
+	typecast to the proper TT_XXX within the function.
+	Update code accordingly.
+
+	* src/truetype/ttdriver.c (Get_Kerning, Set_Char_Sizes,
+	Set_Pixel_Sizes, Load_Glyph, tt_get_interface): Don't use TT_XXX but
+	FT_XXX arguments which are typecast to the proper TT_XXX within the
+	function.
+	Update code accordingly.
+	(tt_driver_class): Remove casts.
+
 2004-05-02  Werner Lemberg  <[email protected]>
 
 	* src/sfnt/ttload.c (tt_face_free_names): Check that `table->names'
--- a/builds/win32/visualc/index.html
+++ b/builds/win32/visualc/index.html
@@ -12,7 +12,7 @@
 
 <p>This directory contains a project files for Visual C++, named
 <tt>freetype.dsp</tt>, and Visual Studio, called <tt>freetype.sln</tt>.  It
-will compile the following libraries from the FreeType 2.1.8 sources:</p>
+will compile the following libraries from the FreeType 2.1.9 sources:</p>
 
 <ul>
   <pre>
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -99,11 +99,12 @@
   /*    They can be implemented by format-specific interfaces.             */
   /*                                                                       */
   static FT_Error
-  Get_Kerning( TT_Face     face,
+  Get_Kerning( FT_Face     ttface,          /* TT_Face */
                FT_UInt     left_glyph,
                FT_UInt     right_glyph,
                FT_Vector*  kerning )
   {
+    TT_Face        face = (TT_Face)ttface;
     TT_Kern0_Pair  pair;
 
 
@@ -194,12 +195,13 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Set_Char_Sizes( TT_Size     size,
+  Set_Char_Sizes( FT_Size     ttsize,       /* TT_Size */
                   FT_F26Dot6  char_width,
                   FT_F26Dot6  char_height,
                   FT_UInt     horz_resolution,
                   FT_UInt     vert_resolution )
   {
+    TT_Size           size     = (TT_Size)ttsize;
     FT_Size_Metrics*  metrics  = &size->root.metrics;
     FT_Size_Metrics*  metrics2 = &size->metrics;
     TT_Face           face     = (TT_Face)size->root.face;
@@ -259,8 +261,16 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Set_Pixel_Sizes( TT_Size  size )
+  Set_Pixel_Sizes( FT_Size  ttsize,         /* TT_Size */
+                   FT_UInt  pixel_width,
+                   FT_UInt  pixel_height )
   {
+    TT_Size  size = (TT_Size)ttsize;
+
+    FT_UNUSED( pixel_width );
+    FT_UNUSED( pixel_height );
+
+
     /* many things have been pre-computed by the base layer */
 
     size->metrics         = size->root.metrics;
@@ -300,12 +310,14 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Load_Glyph( TT_GlyphSlot  slot,
-              TT_Size       size,
+  Load_Glyph( FT_GlyphSlot  ttslot,         /* TT_GlyphSlot */
+              FT_Size       ttsize,         /* TT_Size      */
               FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
-    FT_Error  error;
+    TT_GlyphSlot  slot = (TT_GlyphSlot)ttslot;
+    TT_Size       size = (TT_Size)ttsize;
+    FT_Error      error;
 
 
     if ( !slot )
@@ -377,7 +389,7 @@
 
 
   static FT_Module_Interface
-  tt_get_interface( TT_Driver    driver,
+  tt_get_interface( FT_Module    driver,    /* TT_Driver */
                     const char*  tt_interface )
   {
     FT_Module_Interface  result;
@@ -390,12 +402,12 @@
       return result;
 
     /* only return the default interface from the SFNT module */
-    sfntd = FT_Get_Module( driver->root.root.library, "sfnt" );
+    sfntd = FT_Get_Module( driver->library, "sfnt" );
     if ( sfntd )
     {
       sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
       if ( sfnt )
-        return sfnt->get_interface( FT_MODULE( driver ), tt_interface );
+        return sfnt->get_interface( driver, tt_interface );
     }
 
     return 0;
@@ -424,9 +436,9 @@
 
       (void*)0,        /* driver specific interface */
 
-      (FT_Module_Constructor)tt_driver_init,
-      (FT_Module_Destructor) tt_driver_done,
-      (FT_Module_Requester)  tt_get_interface,
+      tt_driver_init,
+      tt_driver_done,
+      tt_get_interface,
     },
 
     sizeof ( TT_FaceRec ),
@@ -433,21 +445,20 @@
     sizeof ( TT_SizeRec ),
     sizeof ( FT_GlyphSlotRec ),
 
+    tt_face_init,
+    tt_face_done,
+    tt_size_init,
+    tt_size_done,
+    0,                      /* FT_Slot_InitFunc        */
+    0,                      /* FT_Slot_DoneFunc        */
 
-    (FT_Face_InitFunc)       tt_face_init,
-    (FT_Face_DoneFunc)       tt_face_done,
-    (FT_Size_InitFunc)       tt_size_init,
-    (FT_Size_DoneFunc)       tt_size_done,
-    (FT_Slot_InitFunc)       0,
-    (FT_Slot_DoneFunc)       0,
+    Set_Char_Sizes,
+    Set_Pixel_Sizes,
+    Load_Glyph,
 
-    (FT_Size_ResetPointsFunc)Set_Char_Sizes,
-    (FT_Size_ResetPixelsFunc)Set_Pixel_Sizes,
-    (FT_Slot_LoadFunc)       Load_Glyph,
-
-    (FT_Face_GetKerningFunc) Get_Kerning,
-    (FT_Face_AttachFunc)     0,
-    (FT_Face_GetAdvancesFunc)0
+    Get_Kerning,
+    0,                      /* FT_Face_AttachFunc      */
+    0                       /* FT_Face_GetAdvancesFunc */
   };
 
 
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -165,7 +165,7 @@
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
   tt_face_init( FT_Stream      stream,
-                TT_Face        face,
+                FT_Face        ttface,      /* TT_Face */
                 FT_Int         face_index,
                 FT_Int         num_params,
                 FT_Parameter*  params )
@@ -173,6 +173,7 @@
     FT_Error      error;
     FT_Library    library;
     SFNT_Service  sfnt;
+    TT_Face       face = (TT_Face)ttface;
 
 
     library = face->root.driver->root.library;
@@ -269,8 +270,9 @@
   /*    face :: A pointer to the face object to destroy.                   */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  tt_face_done( TT_Face  face )
+  tt_face_done( FT_Face  ttface )           /* TT_Face */
   {
+    TT_Face       face   = (TT_Face)ttface;
     FT_Memory     memory = face->root.memory;
     FT_Stream     stream = face->root.stream;
 
@@ -327,8 +329,9 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  tt_size_init( TT_Size  size )
+  tt_size_init( FT_Size  ttsize )           /* TT_Size */
   {
+    TT_Size   size  = (TT_Size)ttsize;
     FT_Error  error = TT_Err_Ok;
 
 
@@ -485,7 +488,7 @@
 
   Fail_Memory:
 
-    tt_size_done( size );
+    tt_size_done( ttsize );
     return error;
 
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
@@ -505,8 +508,9 @@
   /*    size :: A handle to the target size object.                        */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  tt_size_done( TT_Size  size )
+  tt_size_done( FT_Size  ttsize )           /* TT_Size */
   {
+    TT_Size    size = (TT_Size)ttsize;
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
@@ -851,7 +855,7 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  tt_driver_init( TT_Driver  driver )
+  tt_driver_init( FT_Module  driver )       /* TT_Driver */
   {
     FT_Error  error;
 
@@ -875,9 +879,11 @@
   /*    driver :: A handle to the target TrueType driver.                  */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  tt_driver_done( TT_Driver  driver )
+  tt_driver_done( FT_Module  ttdriver )     /* TT_Driver */
   {
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+    TT_Driver  driver = (TT_Driver)ttdriver;
+
 
     /* destroy the execution context */
     if ( driver->context )
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -380,6 +380,15 @@
   } TT_DriverRec;
 
 
+  /* Note: All of the functions below (except tt_size_reset()) are used    */
+  /* as function pointers in a FT_Driver_ClassRec.  Therefore their        */
+  /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face,  */
+  /* TT_Size, etc., so that the compiler can confirm that the types and    */
+  /* number of parameters are correct.  In all cases the FT_xxx types are  */
+  /* cast to their TT_xxx counterparts inside the functions since FreeType */
+  /* will always use the TT driver to create them.                         */
+
+
   /*************************************************************************/
   /*                                                                       */
   /* Face functions                                                        */
@@ -386,13 +395,13 @@
   /*                                                                       */
   FT_LOCAL( FT_Error )
   tt_face_init( FT_Stream      stream,
-                TT_Face        face,
+                FT_Face        ttface,      /* TT_Face */
                 FT_Int         face_index,
                 FT_Int         num_params,
                 FT_Parameter*  params );
 
   FT_LOCAL( void )
-  tt_face_done( TT_Face  face );
+  tt_face_done( FT_Face  ttface );          /* TT_Face */
 
 
   /*************************************************************************/
@@ -400,10 +409,10 @@
   /* Size functions                                                        */
   /*                                                                       */
   FT_LOCAL( FT_Error )
-  tt_size_init( TT_Size  size );
+  tt_size_init( FT_Size  ttsize );          /* TT_Size */
 
   FT_LOCAL( void )
-  tt_size_done( TT_Size  size );
+  tt_size_done( FT_Size  ttsize );          /* TT_Size */
 
   FT_LOCAL( FT_Error )
   tt_size_reset( TT_Size  size );
@@ -414,10 +423,10 @@
   /* Driver functions                                                      */
   /*                                                                       */
   FT_LOCAL( FT_Error )
-  tt_driver_init( TT_Driver  driver );
+  tt_driver_init( FT_Module  ttdriver );    /* TT_Driver */
 
   FT_LOCAL( void )
-  tt_driver_done( TT_Driver  driver );
+  tt_driver_done( FT_Module  ttdriver );    /* TT_Driver */
 
 
 FT_END_HEADER