shithub: freetype+ttf2subf

Download patch

ref: 8b6db86b0548fc2906ded57a4a5ef240e6d6179e
parent: 0f4eb3d03d3c48cd8d02236cae3abae36c172985
author: David Turner <[email protected]>
date: Sun Aug 17 18:09:14 EDT 2003

* include/freetype/config/ftoption.h, devel/ftoption.h,
        include/freetype/internal/ftobjs.h, include/freetype/internal/tttypes.h,
        src/truetype/ttinterp.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h:

        changed the name of TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING to
        the simpler TT_CONFIG_OPTION_UNPATENTED_HINTING

        removed the macro TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING. Instead,
        the same effect can be used by setting a debug-hook with
        FT_DEBUG_HOOK_UNPATENTED_HINTING globally with FT_Set_Debug_Hook()

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-08-18  David Turner  <[email protected]>
+
+        * include/freetype/config/ftoption.h, devel/ftoption.h,
+        include/freetype/internal/ftobjs.h, include/freetype/internal/tttypes.h,
+        src/truetype/ttinterp.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h:
+
+        changed the name of TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING to
+        the simpler TT_CONFIG_OPTION_UNPATENTED_HINTING
+
+        removed the macro TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING. Instead,
+        the same effect can be used by setting a debug-hook with
+        FT_DEBUG_HOOK_UNPATENTED_HINTING globally with FT_Set_Debug_Hook()
+
 2003-08-06  Werner Lemberg  <[email protected]>
 
 	* src/type1/t1gload.c (T1_Load_Glyph), src/cff/cffgload.c
@@ -254,7 +267,7 @@
 	* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
 	computation of glyph_index.
 	(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
-	only, then try to find a better hit by comparing pixel_width also. 
+	only, then try to find a better hit by comparing pixel_width also.
 	Without this fix it isn't possible to access all strikes.
 	Also compute metrics.max_advance to be in sync with other bitmap
 	drivers.
@@ -548,7 +561,7 @@
 	* include/freetype/ftstroke.h: This.
 
 	* src/base/ftstroker.c: Renamed to...
-	* src/base/ftstroke.c: This.	
+	* src/base/ftstroke.c: This.
 
 	* include/freetype/config/ftheader.h (FT_STROKER_H): Updated.
 
@@ -635,7 +648,7 @@
 
 	* include/freetype/internal/ftobjs.h (FT_Face_InternalRec),
 	include/freetype/internal/psaux.h (T1_DecoderRec),
-	src/cff/cffgload.h (CFF_Builder): Remove `hint_flags' field. 
+	src/cff/cffgload.h (CFF_Builder): Remove `hint_flags' field.
 	Unused.
 
 	* src/cff/cffgload.c (cff_builder_init): Updated.
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -404,27 +404,14 @@
 
   /*************************************************************************/
   /*                                                                       */
-  /* Define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING (in addition to    */
+  /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to            */
   /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented      */
-  /* work-around hinting system.  You must define this if you want either  */
-  /* to force the use of the unpatented hinting system by also defining    */
-  /* TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING, or if you want to select   */
-  /* it at run time using the FT_PARAM_TAG_UNPATENTED_HINTING tag.         */
+  /* work-around hinting system.  Note that for the moment, the algorithm  */
+  /* is only used when selected at runtime through the parameter tag       */
+  /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook               */
+  /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived                  */
   /*                                                                       */
-#define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* Define TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING to restrict the      */
-  /* TrueType bytecode interpreter to actions not protected by patents.    */
-  /* This enables some fonts, for example mingliu.ttc from Dynalab, to     */
-  /* work properly.  They use hinting to make large changes to the glyph   */
-  /* shape, without which the glyph is unrecognisable.                     */
-  /* For this to work you must also define                                 */
-  /* TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING.                          */
-  /*                                                                       */
-#undef  TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING
+#define TT_CONFIG_OPTION_UNPATENTED_HINTING
 
 
   /*************************************************************************/
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -404,27 +404,14 @@
 
   /*************************************************************************/
   /*                                                                       */
-  /* Define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING (in addition to    */
+  /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to            */
   /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented      */
-  /* work-around hinting system.  You must define this if you want either  */
-  /* to force the use of the unpatented hinting system by also defining    */
-  /* TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING, or if you want to select   */
-  /* it at run time using the FT_PARAM_TAG_UNPATENTED_HINTING tag.         */
+  /* work-around hinting system.  Note that for the moment, the algorithm  */
+  /* is only used when selected at runtime through the parameter tag       */
+  /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook               */
+  /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived                  */
   /*                                                                       */
-#define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* Define TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING to restrict the      */
-  /* TrueType bytecode interpreter to actions not protected by patents.    */
-  /* This enables some fonts, for example mingliu.ttc from Dynalab, to     */
-  /* work properly.  They use hinting to make large changes to the glyph   */
-  /* shape, without which the glyph is unrecognisable.                     */
-  /* For this to work you must also define                                 */
-  /* TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING.                          */
-  /*                                                                       */
-#undef  TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING
+#define TT_CONFIG_OPTION_UNPATENTED_HINTING
 
 
   /*************************************************************************/
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -541,7 +541,7 @@
   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
 
  /* */
- 
+
  /*
   * Free the bitmap of a given glyphslot when needed
   * (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap).
@@ -548,8 +548,8 @@
   */
   FT_BASE( void )
   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
- 
 
+
  /*
   * Allocate a new bitmap buffer in a glyph slot.
   */
@@ -673,8 +673,18 @@
   /*************************************************************************/
 
 
-#define FT_DEBUG_HOOK_TRUETYPE  0
-#define FT_DEBUG_HOOK_TYPE1     1
+/* this hook is used by the TrueType debugger. It must be set to an alternate
+ * truetype bytecode interpreter function
+ */
+#define FT_DEBUG_HOOK_TRUETYPE            0
+
+
+/* set this debug hook to a non-null pointer to force unpatented hinting
+ * for all faces when both TT_CONFIG_OPTION_BYTECODE_INTERPRETER and
+ * TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used
+ * during debugging
+ */
+#define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
 
 
   /*************************************************************************/
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1562,7 +1562,7 @@
     /* used to hook the debugger for the `ttdebug' utility.        */
     TT_Interpreter        interpreter;
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     /* Use unpatented hinting only. */
     FT_Bool               unpatented_hinting;
 #endif
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -221,7 +221,7 @@
 #undef  FAILURE
 #define FAILURE  1
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define GUESS_VECTOR( V )                                         \
   if ( CUR.face->unpatented_hinting )                             \
   {                                                               \
@@ -722,7 +722,7 @@
     exec->GS.freeVector = exec->GS.projVector;
     exec->GS.dualVector = exec->GS.projVector;
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     exec->GS.both_x_axis = TRUE;
 #endif
 
@@ -754,7 +754,7 @@
     { 0x4000, 0 },
     { 0x4000, 0 },
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     TRUE,
 #endif
 
@@ -1358,7 +1358,7 @@
   {
     if ( !CUR.tt_metrics.ratio )
     {
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
       if ( CUR.face->unpatented_hinting )
       {
         if ( CUR.GS.both_x_axis )
@@ -1558,7 +1558,7 @@
     FT_F26Dot6  v;
 
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     FT_ASSERT( !CUR.face->unpatented_hinting );
 #endif
 
@@ -2122,7 +2122,7 @@
   Project( EXEC_OP_ FT_Vector*  v1,
                     FT_Vector*  v2 )
   {
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     FT_ASSERT( !CUR.face->unpatented_hinting );
 #endif
 
@@ -2223,7 +2223,7 @@
   static void
   Compute_Funcs( EXEC_OP )
   {
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     if ( CUR.face->unpatented_hinting )
     {
       /* If both vectors point rightwards along the x axis, set             */
@@ -2267,7 +2267,7 @@
 
       return;
     }
-#endif /* TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING */
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
 
     if ( CUR.GS.freeVector.x == 0x4000 )
       CUR.F_dot_P       = CUR.GS.projVector.x * 0x10000L;
@@ -2618,7 +2618,7 @@
   }
 
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define DO_GPV                                   \
     if ( CUR.face->unpatented_hinting )          \
     {                                            \
@@ -2637,7 +2637,7 @@
 #endif
 
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 #define DO_GFV                                   \
     if ( CUR.face->unpatented_hinting )          \
     {                                            \
@@ -5189,7 +5189,7 @@
 
     d = CUR_Func_project( zp.cur + p, zp.org + p );
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     if ( CUR.face->unpatented_hinting )
     {
       if ( CUR.GS.both_x_axis )
@@ -5224,7 +5224,7 @@
                            FT_F26Dot6  dy,
                            FT_Bool     touch )
   {
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     if ( CUR.face->unpatented_hinting )
     {
       if ( CUR.GS.both_x_axis )
@@ -5428,7 +5428,7 @@
       return;
     }
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     if ( CUR.face->unpatented_hinting )
     {
       if ( CUR.GS.both_x_axis )
@@ -6345,7 +6345,7 @@
     FT_ULong   C;
     FT_Long    B;
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     /* Delta hinting is covered by US Patent 5159668. */
     if ( CUR.face->unpatented_hinting )
       {
@@ -6437,7 +6437,7 @@
     FT_Long   B;
 
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     /* Delta hinting is covered by US Patent 5159668. */
     if ( CUR.face->unpatented_hinting )
     {
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -34,7 +34,7 @@
 #include "ttinterp.h"
 #endif
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 #include FT_TRUETYPE_UNPATENTED_H
 #endif
 
@@ -225,14 +225,12 @@
 
     }
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 
     /* Determine whether unpatented hinting is to be used for this face. */
+    face->unpatented_hinting =
+       ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
 
-#ifdef TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING
-    face->unpatented_hinting = TRUE;
-#else
-    face->unpatented_hinting = FALSE;
     {
       int i;
 
@@ -241,9 +239,8 @@
         if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
           face->unpatented_hinting = TRUE;
     }
-#endif /* TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING */
 
-#endif /* TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING */
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
 
     /* initialize standard glyph loading routines */
     TT_Init_Glyph_Loading( face );
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -83,7 +83,7 @@
     FT_UnitVector  projVector;
     FT_UnitVector  freeVector;
 
-#ifdef TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
     FT_Bool        both_x_axis;
 #endif