shithub: freetype+ttf2subf

Download patch

ref: ddbb8e7b6a554bc56a9c5eae88d006fedbc0fa25
parent: 205fc3faf29159a86c4f838edc587952afbb74aa
author: Werner Lemberg <[email protected]>
date: Thu Oct 26 06:04:16 EDT 2000

Some formatting.

Fixed some data types/added header files to remove compiler warnings.

Added trivial input data check to FT_Outline_Get_BBox().

Fixed type1z -> type1 file inclusions.

git/fs: mount .git/fs: mount/attach disallowed
--- a/include/freetype/ftbbox.h
+++ b/include/freetype/ftbbox.h
@@ -56,10 +56,10 @@
   /*    bbox    :: The outline's exact bounding box.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Get_BBox( FT_Outline*  outline,
-                                                FT_BBox     *abbox );
+  FT_EXPORT_DEF( FT_Error )  FT_Outline_Get_BBox( FT_Outline*  outline,
+                                                  FT_BBox*     bbox );
 
 
 #ifdef __cplusplus
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1399,7 +1399,7 @@
     FT_Bool            vertical_info;
     TT_VertHeader      vertical;     /* TT Vertical header, if present */
 
-    FT_Int             num_names;    /* number of name records  */
+    FT_UShort          num_names;    /* number of name records  */
     TT_NameTable       name_table;   /* name table              */
 
     TT_OS2             os2;          /* TrueType OS/2 table            */
@@ -1437,7 +1437,7 @@
     TT_Gasp            gasp;                 /* the `gasp' table */
 
     /* PCL 5 table */
-	TT_PCLT            pclt;
+    TT_PCLT            pclt;
 
     /* embedded bitmaps support */
     FT_Int             num_sbit_strikes;
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -15,14 +15,12 @@
 /*                                                                         */
 /***************************************************************************/
 
+
   /*************************************************************************/
   /*                                                                       */
   /* This component has a _single_ role: to compute exact outline bounding */
   /* boxes.                                                                */
   /*                                                                       */
-  /* It is separated from the rest of the engine for various technical     */
-  /* reasons.  It may well be integrated in `ftoutln' later.               */
-  /*                                                                       */
   /*************************************************************************/
 
 
@@ -30,6 +28,7 @@
 #include <freetype/ftimage.h>
 #include <freetype/ftoutln.h>
 
+
   typedef struct  TBBox_Rec_
   {
     FT_Vector  last;
@@ -45,8 +44,8 @@
   /*                                                                       */
   /* <Description>                                                         */
   /*    This function is used as a `move_to' and `line_to' emitter during  */
-  /*    FT_Outline_Decompose.  It simply records the destination point in  */
-  /*    `user->last'.                                                      */
+  /*    FT_Outline_Decompose().  It simply records the destination point   */
+  /*    in `user->last'.                                                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    to   :: A pointer to the destination vector.                       */
@@ -55,7 +54,7 @@
   /*    user :: A pointer to the current walk context.                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   static
   int  BBox_Move_To( FT_Vector*  to,
@@ -151,7 +150,7 @@
   /*    user    :: The address of the current walk context.                */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In the case of a non-monotonous arc, we compute directly the       */
@@ -273,7 +272,7 @@
 
     Suite:
       ;
-    } while (arc >= stack);
+    } while ( arc >= stack );
   }
 
 
@@ -297,7 +296,7 @@
   /*    user     :: The address of the current walk context.               */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In the case of a non-monotonous arc, we don't compute directly     */
@@ -354,21 +353,24 @@
   /*    abbox   :: A pointer to the outline's exact bounding box.          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_EXPORT_FUNC( FT_Error )  FT_Outline_Get_BBox( FT_Outline*  outline,
                                                    FT_BBox*     abbox )
   {
-    FT_BBox    cbox;
-    FT_BBox    bbox;
-    FT_Vector* vec;
-    FT_UShort  n;
+    FT_BBox     cbox;
+    FT_BBox     bbox;
+    FT_Vector*  vec;
+    FT_UShort   n;
 
 
-    /* if outline is empty, return (0,0,0,0) */
+    if ( !abbox )
+      return FT_Err_Invalid_Argument;
+
     if ( !outline )
       return FT_Err_Invalid_Outline;
 
+    /* if outline is empty, return (0,0,0,0) */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
     {
       abbox->xMin = abbox->xMax = 0;
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -48,7 +48,7 @@
 #
 BASE_EXT_SRC := $(BASE_)ftglyph.c \
                 $(BASE_)ftmm.c    \
-		$(BASE_)ftbbox.c
+                $(BASE_)ftbbox.c
 
 # Default extensions objects
 #
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -24,6 +24,8 @@
 
 #include <string.h>
 
+#include <freetype/internal/ftmemory.h>
+
 
   /*************************************************************************/
   /*************************************************************************/
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -68,7 +68,7 @@
   };
 
 
-  LOCAL_FUNC
+  static
   const PSAux_Interface  psaux_interface =
   {
     &ps_table_funcs,
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -269,7 +269,8 @@
   }
 
 
-  static const PSNames_Interface  psnames_interface =
+  static
+  const PSNames_Interface  psnames_interface =
   {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -169,7 +169,7 @@
     FT_Error   error;
 
     FT_Int     num_glyphs;
-    FT_Int     num_names;
+    FT_UShort  num_names;
 
     FT_UShort* glyph_indices = 0;
     FT_Char**  name_strings  = 0;
@@ -229,7 +229,7 @@
 
     /* now load the name strings */
     {
-      FT_Int  n;
+      FT_UShort  n;
 
 
       if ( ALLOC_ARRAY( name_strings, num_names, FT_Char* ) )
@@ -264,7 +264,7 @@
 
   Fail1:
     {
-      FT_Int  n;
+      FT_UShort  n;
 
 
       for ( n = 0; n < num_names; n++ )
@@ -401,7 +401,7 @@
       case 0x00020000L:
         {
           TT_Post_20*  table = &names->names.format_20;
-          FT_UInt      n;
+          FT_UShort    n;
 
 
           FREE( table->glyph_indices );
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -1,6 +1,6 @@
 /***************************************************************************/
 /*                                                                         */
-/*  type1z.c                                                               */
+/*  type1.c                                                                */
 /*                                                                         */
 /*    FreeType experimental Type 1 driver component (body only).           */
 /*                                                                         */
@@ -33,14 +33,14 @@
 
 #else /* FT_FLAT_COMPILE */
 
-#include <type1z/z1parse.c>
-#include <type1z/z1load.c>
-#include <type1z/z1objs.c>
-#include <type1z/z1driver.c>
-#include <type1z/z1gload.c>
+#include <type1/z1parse.c>
+#include <type1/z1load.c>
+#include <type1/z1objs.c>
+#include <type1/z1driver.c>
+#include <type1/z1gload.c>
 
 #ifndef Z1_CONFIG_OPTION_NO_AFM
-#include <type1z/z1afm.c>
+#include <type1/z1afm.c>
 #endif
 
 #endif /* FT_FLAT_COMPILE */
--- a/src/type1/z1afm.c
+++ b/src/type1/z1afm.c
@@ -22,7 +22,7 @@
 
 #else
 
-#include <type1z/z1afm.h>
+#include <type1/z1afm.h>
 
 #endif
 
--- a/src/type1/z1afm.h
+++ b/src/type1/z1afm.h
@@ -26,7 +26,7 @@
 
 #else
 
-#include <type1z/z1objs.h>
+#include <type1/z1objs.h>
 
 #endif
 
--- a/src/type1/z1driver.c
+++ b/src/type1/z1driver.c
@@ -25,10 +25,10 @@
 
 #else
 
-#include <type1z/z1driver.h>
-#include <type1z/z1gload.h>
-#include <type1z/z1load.h>
-#include <type1z/z1afm.h>
+#include <type1/z1driver.h>
+#include <type1/z1gload.h>
+#include <type1/z1load.h>
+#include <type1/z1afm.h>
 
 #endif
 
--- a/src/type1/z1gload.c
+++ b/src/type1/z1gload.c
@@ -22,7 +22,7 @@
 
 #else
 
-#include <type1z/z1gload.h>
+#include <type1/z1gload.h>
 
 #endif
 
--- a/src/type1/z1gload.h
+++ b/src/type1/z1gload.h
@@ -26,7 +26,7 @@
 
 #else
 
-#include <type1z/z1objs.h>
+#include <type1/z1objs.h>
 
 #endif
 
--- a/src/type1/z1load.c
+++ b/src/type1/z1load.c
@@ -75,7 +75,7 @@
 
 #else
 
-#include <type1z/z1load.h>
+#include <type1/z1load.h>
 
 #endif
 
@@ -1388,7 +1388,7 @@
 
 #else
 
-#include <type1z/z1tokens.h>
+#include <type1/z1tokens.h>
 
 #endif
 
--- a/src/type1/z1load.h
+++ b/src/type1/z1load.h
@@ -30,7 +30,7 @@
 
 #else
 
-#include <type1z/z1parse.h>
+#include <type1/z1parse.h>
 
 #endif
 
--- a/src/type1/z1objs.c
+++ b/src/type1/z1objs.c
@@ -28,9 +28,9 @@
 
 #else
 
-#include <type1z/z1gload.h>
-#include <type1z/z1load.h>
-#include <type1z/z1afm.h>
+#include <type1/z1gload.h>
+#include <type1/z1load.h>
+#include <type1/z1afm.h>
 
 #endif
 
--- a/src/type1/z1parse.c
+++ b/src/type1/z1parse.c
@@ -46,7 +46,7 @@
 
 #else
 
-#include <type1z/z1parse.h>
+#include <type1/z1parse.h>
 
 #endif