shithub: freetype+ttf2subf

Download patch

ref: 2d8629b3931dfc66ce5411553e89ea8ffd1b0f7e
parent: bd50295ca4c86ee46e330272078ac58cc60728d8
author: Werner Lemberg <[email protected]>
date: Sun Sep 3 02:18:45 EDT 2006

* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

* src/smooth/ftgrays.c (gray_record_cell): Remove shadowing
variable declaration.
(gray_convert_glyph): Fix compiler warnings.

Formatting, copyright years.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,39 @@
+2006-09-03  Werner Lemberg  <[email protected]>
+
+	* devel/ftoption.h: Synchronize with
+	include/freetype/config/ftoption.h.
+
+	* src/smooth/ftgrays.c (gray_record_cell): Remove shadowing
+	variable declaration.
+	(gray_convert_glyph): Fix compiler warnings.
+
 2006-09-01  David Turner  <[email protected]>
 
-    * src/truetype/ttobjs.c: updated the TrueType loader to recognize
-    a few fonts that require the automatic unpatented loader
+	* src/truetype/ttobjs.c (tt_face_init): Update the TrueType loader
+	to recognize a few fonts that require the automatic unpatented
+	loader.
 
-    * src/smooth/ftgrays.c: optmized the performance of the anti-aliased
-    rasterizer. The speed gains is between 15% and 25%, depending on
-    content
+	* src/smooth/ftgrays.c: Optmize the performance of the anti-aliased
+	rasterizer.  The speed improvement is between 15% and 25%, depending
+	on the font data.
 
+	(GRAYS_USE_GAMMA, GRAYS_COMPACT): Removed, and all associated code.
+	(TCell): Redefine.
+	(TRaster): New members `buffer', `buffer_size', `ycells', `ycount'.
+	(gray_init_cells): Updated.
+	(gray_find_cell, gray_alloc_cell): New functions.
+	(gray_record_cell): Rewritten to use `gray_find_cell' and
+	`gray_alloc_cell'.
+	(PACK, LESS_THAN, SWAP_CELLS, DEBUG_SORT, QUICK_SORT, SHELL_SORT,
+	QSORT_THRESHOLD):
+	Removed.
+	(gray_shell_sort, gray_quick_sort, gray_check_sort,
+	gray_dump_cells): Removed.
+	(gray_sweep): Rewritten.
+	(gray_convert_glyph): Rewrite code which used one of the sorting
+	functions.
+	(gray_raster_render): Updated.
+
 2006-08-29  Dr. Werner Fink  <[email protected]>
 
 	* configure: Make it possible to handle configure options which
@@ -14,28 +41,45 @@
 
 2006-08-27  David Turner  <[email protected]>
 
-	<TO BE WRITTEN>
+	* include/freetype/config/ftoption.h (TT_USE_BYTECODE_INTERPRETER):
+	New macro, defined if either TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+	or TT_CONFIG_OPTION_UNPATENTED_HINTING is defined.
 
+	* include/freetype/internal/ftcalc.h, src/base/ftcalc.c,
+	src/truetype/truetype.c, src/truetype/ttdriver.c,
+	src/truetype/ttgload.c, src/truetype/ttgload.h,
+	src/truetype/ttinterp.c, src/truetype/ttobjs.c,
+	src/truetype/ttobjs.h, src/truetype/ttpload.c, src/type42/t42drivr.c:
+	s/TT_CONFIG_OPTION_BYTECODE_INTERPRETER/TT_USE_BYTECODE_INTERPRETER/.
+
+	* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
+	member `force_autohint'.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Use `force_autohint'.
+
+	* src/truetype/ttobjs.c (tt_face_init): Prepare code for testing
+	against a list of font names which need the bytecode interpreter.
+
 2006-08-27  Jens Claudius  <[email protected]>
 
 	Fix miscellaneous compiler warnings.
 
-	* freetype2/include/freetype/internal/ftobjs.h: close
-	comment with `*/' to avoid `/* in comment' compiler warning.
+	* freetype2/include/freetype/internal/ftobjs.h: Close comment with
+	`*/' to avoid `/* in comment' compiler warning.
 
-	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn
-	cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)'
-	since on 64-bit platforms void* is larger than FT_UInt32.
+	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast
+	`(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on
+	64-bit platforms void* is larger than FT_UInt32.
 
-	* freetype2/src/base/ftobjs.c (t_validator_error): cast
-	away volatileness of argument to ft_longjmp. Spotted by
-	Werner `Putzfrau' Lemberg.
+	* freetype2/src/base/ftobjs.c (t_validator_error): Cast away
+	volatileness of argument to ft_longjmp.  Spotted by Werner
+	`Putzfrau' Lemberg.
 
-	* freetype2/src/bdf/bdflib.c (bdf_load_font): initialize
-	local variable `lineno'.
+	* freetype2/src/bdf/bdflib.c (bdf_load_font): Initialize local
+	variable `lineno'.
 
-	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate):
-	mark local variable `error' volatile.
+	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate): Mark local
+	variable `error' as volatile.
 
 2006-08-27  Werner Lemberg  <[email protected]>
 
@@ -1248,10 +1292,10 @@
 	(FTC_CMapCache_Lookup) [FT_CONFIG_OPTION_OLD_INTERNALS]: New
 	compatibility code.
 
-    * src/cache/ftcbasic.c: fixed a silly bug that prevented our super-duper
-    "hack" to support rogue clients compiled against 2.1.7 to work correctly.
-    Probably explains the GNUstep crashes with the second release
-    candidate.
+	* src/cache/ftcbasic.c: Fix a silly bug that prevented our `hack' to
+	support rogue clients compiled against 2.1.7 to work correctly. 
+	This probably explains the GNUstep crashes with the second release
+	candidate.
 
 2006-02-23  Chia-I Wu  <[email protected]>
 
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -471,7 +471,7 @@
   /* component offsets in composite glyphs.                                */
   /*                                                                       */
   /* Apple and MS disagree on the default behavior of component offsets    */
-  /* in composites.  Apple says that they should be scaled by the scale    */
+  /* in composites.  Apple says that they should be scaled by the scaling  */
   /* factors in the transformation matrix (roughly, it's more complex)     */
   /* while MS says they should not.  OpenType defines two bits in the      */
   /* composite flags array which can be used to disambiguate, but old      */
@@ -593,6 +593,16 @@
    */
 #undef FT_CONFIG_OPTION_OLD_INTERNALS
 
+
+  /*
+   * This variable is defined if either unpatented or native TrueType
+   * hinting is requested by the definitions above.
+   */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
+#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
+#define  TT_USE_BYTECODE_INTERPRETER
+#endif
 
 FT_END_HEADER
 
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -572,7 +572,7 @@
 #define AF_CONFIG_OPTION_CJK
 
 
- /* */
+  /* */
 
   /*
    * This temporary macro is used to control various optimizations for
@@ -594,14 +594,14 @@
 #define FT_CONFIG_OPTION_OLD_INTERNALS
 
 
- /*
-  * this variable is defined if either unpatented or native TrueType
-  * hinting is requested by the definitions above.
-  */
+  /*
+   * This variable is defined if either unpatented or native TrueType
+   * hinting is requested by the definitions above.
+   */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#  define  TT_USE_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
-#  define  TT_USE_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
 #endif
 
 FT_END_HEADER
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -212,25 +212,25 @@
   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   /*                                                                       */
   /*    force_autohing ::                                                  */
-  /*      this boolean flag is used to instruct the glyph loader to        */
-  /*      ignore the format-specific hinter, and use the auto-hinter       */
-  /*      instead to load all glyphs.                                      */
+  /*      This boolean flag instructs the glyph loader to ignore the       */
+  /*      format-specific hinter, and to use the auto-hinter instead to    */
+  /*      load all glyphs.                                                 */
   /*                                                                       */
-  /*      if the unpatented bytecode interpreter was compiled withing      */
-  /*      the library then:                                                */
+  /*      If the unpatented bytecode interpreter is compiled into the      */
+  /*      library, then:                                                   */
   /*                                                                       */
   /*      - if this is one of the tricky Asian fonts, like Gulim, which    */
   /*        absolutely require a bytecode interpreter to load anything     */
-  /*        properly, the flag will be set to FALSE                        */
+  /*        properly, the flag is set to FALSE                             */
   /*                                                                       */
-  /*      - for other fonts, the flag will be set to TRUE, and the         */
-  /*        auto-hinter will be used to scale the glyphs.                  */
+  /*      - for other fonts, the flag is set to TRUE, and the auto-hinter  */
+  /*        is used to scale the glyphs.                                   */
   /*                                                                       */
-  /*      if the unpatented bytecode interpretr was *not* compiled         */
-  /*      within the librayr, the flag will always be FALSE                */
+  /*      If the unpatented bytecode interpreter is not compiled into      */
+  /*      the library, the flag is always set to FALSE.                    */
   /*                                                                       */
-  /*      the detection of "tricky" fonts is located in the TrueType       */
-  /*      face loader.                                                     */
+  /*      The detection of `tricky' fonts is located in the TrueType       */
+  /*      face loader, testing against a bunch of font names.              */
   /*                                                                       */
   typedef struct  FT_Face_InternalRec_
   {
@@ -644,8 +644,8 @@
 
 
   /* Set this debug hook to a non-null pointer to force unpatented hinting */
-  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and     */
-  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used    */
+  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */
+  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */
   /* during debugging.                                                     */
 #define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
 
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -133,10 +133,8 @@
 #define FT_TRACE( x )  do ; while ( 0 )     /* nothing */
 #endif
 
-
 #else /* _STANDALONE_ */
 
-
 #include <ft2build.h>
 #include "ftgrays.h"
 #include FT_INTERNAL_OBJECTS_H
@@ -148,7 +146,6 @@
 #define ErrRaster_Invalid_Mode     Smooth_Err_Cannot_Render_Glyph
 #define ErrRaster_Invalid_Outline  Smooth_Err_Invalid_Outline
 
-
 #endif /* _STANDALONE_ */
 
 
@@ -326,13 +323,13 @@
     ras.buffer      = buffer;
     ras.buffer_size = byte_size;
 
-    ras.ycells    = (PCell*) buffer;
-    ras.cells     = NULL;
-    ras.max_cells = 0;
-    ras.num_cells = 0;
-    ras.area      = 0;
-    ras.cover     = 0;
-    ras.invalid   = 1;
+    ras.ycells      = (PCell*) buffer;
+    ras.cells       = NULL;
+    ras.max_cells   = 0;
+    ras.num_cells   = 0;
+    ras.area        = 0;
+    ras.cover       = 0;
+    ras.invalid     = 1;
   }
 
 
@@ -385,11 +382,12 @@
   /* Record the current cell in the table.                                 */
   /*                                                                       */
   static PCell*
-  gray_find_cell( RAS_ARG_  TCoord  x,
-                            TCoord  y )
+  gray_find_cell( RAS_ARG_ TCoord  x,
+                           TCoord  y )
   {
     PCell  *pnode, node;
 
+
     pnode = &ras.ycells[y];
     for (;;)
     {
@@ -399,15 +397,17 @@
 
       pnode = &node->next;
     }
-    return  pnode;
+
+    return pnode;
   }
 
 
   static PCell
-  gray_alloc_cell( RAS_ARG_  TCoord  x )
+  gray_alloc_cell( RAS_ARG_ TCoord  x )
   {
     PCell  cell;
 
+
     if ( ras.num_cells >= ras.max_cells )
       ft_longjmp( ras.jump_buffer, 1 );
 
@@ -423,13 +423,10 @@
   static void
   gray_record_cell( RAS_ARG )
   {
-    PCell  cell;
-
-
     if ( !ras.invalid && ( ras.area | ras.cover ) )
     {
-      TCoord  x       = (TCoord)(ras.ex - ras.min_ex);
-      TCoord  y       = (TCoord)(ras.ey - ras.min_ey);
+      TCoord  x       = (TCoord)( ras.ex - ras.min_ex );
+      TCoord  y       = (TCoord)( ras.ey - ras.min_ey );
       PCell  *pparent = gray_find_cell( RAS_VAR_ x, y );
       PCell   cell    = *pparent;
 
@@ -445,6 +442,7 @@
     }
   }
 
+
   /*************************************************************************/
   /*                                                                       */
   /* Set the current cell to a new position.                               */
@@ -1257,6 +1255,7 @@
 
     FT_UNUSED( target );
 
+
     if ( ras.num_cells == 0 )
       return;
 
@@ -1268,15 +1267,18 @@
       TCoord  cover = 0;
       TCoord  x     = 0;
 
+
       for ( ; cell != NULL; cell = cell->next )
       {
         TArea  area;
 
+
         if ( cell->x > x && cover != 0 )
-          gray_hline( RAS_VAR_ x, yindex, cover*(ONE_PIXEL*2), cell->x - x );
+          gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
+                      cell->x - x );
 
         cover += cell->cover;
-        area   = cover*(ONE_PIXEL*2) - cell->area;
+        area   = cover * ( ONE_PIXEL * 2 ) - cell->area;
 
         if ( area != 0 && cell->x >= 0 )
           gray_hline( RAS_VAR_ cell->x, yindex, area, 1 );
@@ -1285,8 +1287,8 @@
       }
 
       if ( cover != 0 )
-        gray_hline( RAS_VAR_ x, yindex, cover*(ONE_PIXEL*2),
-                    (ras.max_ex - x) );
+        gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
+                    ras.max_ex - x );
     }
 
     if ( ras.render_span && ras.num_gray_spans > 0 )
@@ -1294,6 +1296,7 @@
                        ras.gray_spans, ras.render_span_data );
   }
 
+
 #ifdef _STANDALONE_
 
   /*************************************************************************/
@@ -1646,10 +1649,11 @@
         int   error;
 
         {
-          PCell   cells_max;
-          int     yindex, ycount;
-          long    cell_start, cell_mod;
+          PCell  cells_max;
+          int    yindex;
+          long   cell_start, cell_mod;
 
+
           ras.ycells = (PCell*)ras.buffer;
           ras.ycount = band->max - band->min;
 
@@ -1656,18 +1660,18 @@
           for ( yindex = 0; yindex < ras.ycount; yindex++ )
             ras.ycells[yindex] = NULL;
 
-          cell_start = sizeof(PCell)*ras.ycount;
-          cell_mod   = cell_start % sizeof(TCell);
+          cell_start = sizeof ( PCell ) * ras.ycount;
+          cell_mod   = cell_start % sizeof ( TCell );
           if ( cell_mod > 0 )
-            cell_start += sizeof(TCell) - cell_mod;
+            cell_start += sizeof ( TCell ) - cell_mod;
 
-          cells_max = (PCell)(ras.buffer + ras.buffer_size);
-          ras.cells = (PCell)((char*)ras.buffer + cell_start);
+          cells_max = (PCell)( (char*)ras.buffer + ras.buffer_size );
+          ras.cells = (PCell)( (char*)ras.buffer + cell_start );
           if ( ras.cells >= cells_max )
             goto ReduceBands;
 
-          ras.max_cells = (cells_max - ras.cells);
-          if (ras.max_cells < 2)
+          ras.max_cells = cells_max - ras.cells;
+          if ( ras.max_cells < 2 )
             goto ReduceBands;
         }
 
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType TrueType driver component (body only).                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2004 by                                           */
+/*  Copyright 1996-2001, 2004, 2006 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -261,9 +261,8 @@
           face->unpatented_hinting = TRUE;
     }
 
-   /* compare the face with a list of well-known "tricky' fonts !!
-    * this list shall be expanded as we find them
-    */
+    /* Compare the face with a list of well-known `tricky' fonts. */
+    /* This list shall be expanded as we find more of them.       */
     if ( !face->unpatented_hinting )
     {
       static const char* const  trick_names[] =
@@ -275,11 +274,11 @@
         "PMingLiU",        /* mingliu.ttc */
         NULL
       };
-      int   nn;
+      int  nn;
 
-     /* note that we only check the face name at the moment, it might
-      * be worthy to do more checks for a few special cases
-      */
+
+      /* Note that we only check the face name at the moment; it might */
+      /* be worth to do more checks for a few special cases.           */
       for ( nn = 0; trick_names[nn] != NULL; nn++ )
       {
         if ( ft_strcmp( ttface->family_name, trick_names[nn] ) == 0 )
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -209,9 +209,9 @@
     if ( info->is_fixed_pitch )
       root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
-    /* note, only define if we have the patented bytecode interpreter,
-     * there are no known "tricky" Type42 fonts that could be loaded
-     * with the unpatented interpreter */
+    /* We only set this flag if we have the patented bytecode interpreter. */
+    /* There are no known `tricky' Type42 fonts that could be loaded with  */
+    /* the unpatented interpreter.                                         */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
     root->face_flags |= FT_FACE_FLAG_HINTER;
 #endif