Commit b3ba40ddfdcbce66a95e93257b07d4a991c556c2

David Turner 2001-10-07T13:30:26

* include/freetype/ftsizes.h, src/base/ftobjs.c, src/cache/ftcmanag.c: added a new header, named "ftsizes.h" (FT_SIZES_H) to provide a public API to manage multiple size objects for a given FT_Face.

diff --git a/ChangeLog b/ChangeLog
index bc83214..9399dd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,11 @@
 	with "gray_", and a new type (TArea) is defined to store area value in
 	each cell (using "int" was too small on 16-bit systems)..
 
+	* include/freetype/ftsizes.h, src/base/ftobjs.c, src/cache/ftcmanag.c:
+	added a new header, named "ftsizes.h" (FT_SIZES_H) to provide a public
+	API to manage multiple size objects for a given FT_Face.
+
+
 2001-09-20  Detlef Würkner  <TetiSoft@apg.lahn.de>
 
 	* builds/amiga/*: Added port to Amiga with the SAS/C compiler.
diff --git a/docs/BUGS b/docs/BUGS
index a6cb04c..e02b3b1 100644
--- a/docs/BUGS
+++ b/docs/BUGS
@@ -30,6 +30,7 @@ NO-CID-CMAPS            13-09-2001     David                     always
 AUTOHINT-NO-SBITS       13-09-2001     David                     always
 BAD-TT-RENDERING        12-09-2001     Paul Pedriana             ?
 BAD-THIN-LINES          13-09-2001     David                     ?
+NOT-WINDOWS-METRICS     07-10-2001     David                     always
 
 --------------------END-OF-OPENED-BUGS-TABLE----------------------------------
 
@@ -107,3 +108,10 @@ BAD-THIN-LINES
    it seems that the anti-aliased renderer in FreeType has problems
    rendering extremely thin straight lines correctly, at least when using
    the FT_Outline_Render functions..
+
+
+NOT-WINDOWS-METRICS
+   FreeType doesn't always return the same metrics as Windows for ascender,
+   descender and text height, depending on character pixel sizes. A lot of
+   testing on Windows is needed to debug this properly. It might be due to
+   a rounding bug when computing the "x_scale" and "y_scale" values.
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index fc1e6bf..9654dfe 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -249,6 +249,19 @@
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
+  /*    FT_SIZES_H                                                         */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    A macro used in #include statements to name the file containing    */
+  /*    the API used to manage multiple @FT_Size objects per face.         */
+  /*                                                                       */
+#define FT_SIZES_H    <freetype/ftsizes.h>
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @macro:                                                               */
   /*    FT_MODULE_H                                                        */
   /*                                                                       */
   /* @description:                                                         */
diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h
index fcb88cd..3c107d8 100644
--- a/include/freetype/ftchapters.h
+++ b/include/freetype/ftchapters.h
@@ -15,6 +15,7 @@
 /*    truetype_tables                                                      */
 /*    type1_tables                                                         */
 /*    sfnt_names                                                           */
+/*    sizes_management                                                     */
 /*    module_management                                                    */
 /*    system_interface                                                     */
 /*    header_file_macros                                                   */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 1ffacbc..7fc5fd3 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -29,6 +29,7 @@
 
 #include <ft2build.h>
 #include FT_RENDER_H
+#include FT_SIZES_H
 #include FT_INTERNAL_MEMORY_H
 #include FT_INTERNAL_DRIVER_H
 #include FT_INTERNAL_AUTOHINT_H
@@ -305,46 +306,6 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    FT_New_Size                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new size object from a given face object.                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A handle to a parent face object.                          */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    asize :: A handle to a new size object.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_New_Size( FT_Face   face,
-               FT_Size*  size );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Done_Size                                                       */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Discards a given size object.                                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    size :: A handle to a target size object.                          */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_Done_Size( FT_Size  size );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
   /*    FT_New_GlyphSlot                                                   */
   /*                                                                       */
   /* <Description>                                                         */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index b41562a..d835d59 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1931,6 +1931,26 @@
   }
 
 
+  FT_EXPORT_DEF( FT_Error )
+  FT_Activate_Size( FT_Size   size )
+  {
+    FT_Face  face;
+    
+    if ( size == NULL )
+      return FT_Err_Bad_Argument;
+      
+    face = size->face;
+    if ( face == NULL || face->driver == NULL )
+      return FT_Err_Bad_Argument;
+    
+    /* we don't need anything more complex than that, all size objects */
+    /* are already listed by the face..                                */
+    face->size = size;
+    
+    return FT_Err_Ok;
+  }
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 12f6257..b35bdb6 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -22,6 +22,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_LIST_H
+#include FT_SIZES_H
 
 #include "ftcerror.h"
 
@@ -123,7 +124,7 @@
     error = FT_New_Size( face, &size );
     if ( !error )
     {
-      face->size = size;
+      FT_Activate_Size( size );
       error = FT_Set_Pixel_Sizes( face,
                                   font_req->width,
                                   font_req->height );
@@ -159,7 +160,7 @@
 
     if ( size->face == req->face )
     {
-      size->face->size = size;  /* set current size */
+      FT_Activate_Size(size);
       error = FT_Set_Pixel_Sizes( req->face, req->width, req->height );
       if ( error )
         FT_Done_Size( size );
@@ -267,6 +268,7 @@
     manager->max_bytes    = max_bytes;
     manager->request_face = requester;
     manager->request_data = req_data;
+
     *amanager = manager;
 
   Exit: