shithub: freetype+ttf2subf

Download patch

ref: 046bf8b0cc9210343af15ede701baa95fee0157f
parent: 2863cfa7c91caef9037e192b0fa0347aeba24da9
author: Werner Lemberg <[email protected]>
date: Tue Oct 3 04:43:42 EDT 2006

formatting

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,8 +6,14 @@
 
 2006-09-30  David Turner  <[email protected]>
 
-	* include/freetype/internal/ftobjs.h, src/base/ftobjs.c,
-	src/truetype/ttobjs.c: fixes related to the unpatented hinter
+	* include/freetype/internal/ftobjs.h (FT_Face_InternalRec):
+	s/unpatented_hinting/ignore_unpatented_hinter/.
+	Update all callers.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Refine the algorithm whether
+	auto-hinting shall be used or not.
+
+	* src/truetype/ttobjs.c (tt_face_init): Ditto.
 	
 2006-09-30  Werner Lemberg  <[email protected]>
 
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -212,10 +212,10 @@
   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   /*                                                                       */
   /*    ignore_unpatented_hinter ::                                        */
-  /*      This boolean flag instructs the glyph loader to ignore           */
-  /*      the native font hinter, if one is found. This is exclusively     */
-  /*      used in the case when the unpatented hinter is compiled within   */
-  /*      the library.                                                    */
+  /*      This boolean flag instructs the glyph loader to ignore the       */
+  /*      native font hinter, if one is found.  This is exclusively used   */
+  /*      in the case when the unpatented hinter is compiled within the    */
+  /*      library.                                                         */
   /*                                                                       */
   typedef struct  FT_Face_InternalRec_
   {
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -573,44 +573,43 @@
       load_flags &= ~FT_LOAD_RENDER;
     }
 
-    /* determine wether we need to auto-hint or not
-    * the general rules are:
-    *
-    * - only auto-hint if we have a hinter module, a
-    *   scalable font format dealing with outlines,
-    *   no transforms except simple slants
-    *
-    * - then, autohint if FT_LOAD_FORCE_AUTOHINT is set
-    *   or if we don't have a native font hinter
-    *
-    * - otherwise, autohint for LIGHT hinting mode
-    *
-    * - except if the font requires the unpatented
-    *   bytecode interpreter to load properly
-    */
+    /*
+     * Determine whether we need to auto-hint or not.
+     * The general rules are:
+     *
+     * - Do only auto-hinting if we have a hinter module,
+     *   a scalable font format dealing with outlines,
+     *   and no transforms except simple slants.
+     *
+     * - Then, autohint if FT_LOAD_FORCE_AUTOHINT is set
+     *   or if we don't have a native font hinter.
+     *
+     * - Otherwise, auto-hint for LIGHT hinting mode.
+     *
+     * - Exception: The font requires the unpatented
+     *   bytecode interpreter to load properly.
+     */
 
     autohint = 0;
-    if ( hinter &&
-         (load_flags & FT_LOAD_NO_HINTING) == 0   &&
-         (load_flags & FT_LOAD_NO_AUTOHINT) == 0  &&
-         FT_DRIVER_IS_SCALABLE( driver )          &&
-         FT_DRIVER_USES_OUTLINES( driver )        &&
-         face->internal->transform_matrix.yy > 0  &&
-         face->internal->transform_matrix.yx == 0 )
+    if ( hinter                                    &&
+         ( load_flags & FT_LOAD_NO_HINTING  ) == 0 &&
+         ( load_flags & FT_LOAD_NO_AUTOHINT ) == 0 &&
+         FT_DRIVER_IS_SCALABLE( driver )           &&
+         FT_DRIVER_USES_OUTLINES( driver )         &&
+         face->internal->transform_matrix.yy > 0   &&
+         face->internal->transform_matrix.yx == 0  )
     {
-      if ( (load_flags & FT_LOAD_FORCE_AUTOHINT) != 0 ||
-           !FT_DRIVER_HAS_HINTER( driver ) )
+      if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) != 0 ||
+           !FT_DRIVER_HAS_HINTER( driver )              )
         autohint = 1;
-
       else
       {
-        FT_Render_Mode  mode = FT_LOAD_TARGET_MODE(load_flags);
+        FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );
 
+
         if ( mode == FT_RENDER_MODE_LIGHT             ||
              face->internal->ignore_unpatented_hinter )
-        {
           autohint = 1;
-        }
       }
     }
 
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -246,16 +246,17 @@
 
     }
 
-#if defined(TT_CONFIG_OPTION_UNPATENTED_HINTING) && \
-    !defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
+#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \
+    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
 
     {
       FT_Bool  unpatented_hinting;
       int      i;
 
+
       /* Determine whether unpatented hinting is to be used for this face. */
       unpatented_hinting = FT_BOOL
-       ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
+        ( library->debug_hooks[FT_DEBUG_HOOK_UNPATENTED_HINTING] != NULL );
 
       for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
         if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
@@ -293,7 +294,8 @@
       ttface->internal->ignore_unpatented_hinter = !unpatented_hinting;
     }
 
-#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
+          !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
     /* initialize standard glyph loading routines */
     TT_Init_Glyph_Loading( face );