shithub: freetype+ttf2subf

Download patch

ref: 5b5f382b7d093e085d41be95cd73075acb5cd1a2
parent: 0779163ef90b9445a2c158de03aa8092d1667123
author: David Turner <[email protected]>
date: Wed Dec 14 11:37:15 EST 2005

* src/autofit/aflatin.c, src/autofit/afhints.c: changed the
        implementation of the LIGHT hinting mode to completely disable
        horizontal hinting. This is an experimental effort to integrate
        David Chester's latest patch without fucking the other hinting
        modes as well.

        Note that this doesn't force auto-hinting for all fonts however.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-12-13  David Turner  <[email protected]>
+
+	* src/autofit/aflatin.c, src/autofit/afhints.c: changed the
+        implementation of the LIGHT hinting mode to completely disable
+        horizontal hinting. This is an experimental effort to integrate
+        David Chester's latest patch without fucking the other hinting
+        modes as well.
+
+        Note that this doesn't force auto-hinting for all fonts however.
+
 2005-12-07  Werner Lemberg  <[email protected]>
 
 	* src/sfnt/sfobjc.c (sfnt_init_face): Move tag check to...
@@ -33,11 +43,11 @@
 	segments for cmap format 4.  For overlapping but sorted segments,
 	which is previously considered unsorted, we still use binary search.
 
-	* src/sfnt/ttcmap.h (TT_CMapRec_): Replace `unsorted' by `flags'. 
+	* src/sfnt/ttcmap.h (TT_CMapRec_): Replace `unsorted' by `flags'.
 	(TT_CMAP_FLAG_UNSORTED, TT_CMAP_FLAG_OVERLAPPED): New macros.
 
 	* src/sfnt/ttcmap.c (OPT_CMAP4): Removed as it is always defined.
-	(TT_CMap4Rec_): Remove `old_charcode' and `table_length'.  
+	(TT_CMap4Rec_): Remove `old_charcode' and `table_length'.
 	(tt_cmap4_reset): Removed.
 	(tt_cmap4_init): Updated accordingly.
 	(tt_cmap4_next): Updated accordingly.
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -509,7 +509,8 @@
   af_glyph_hints_rescale( AF_GlyphHints     hints,
                           AF_ScriptMetrics  metrics )
   {
-    hints->metrics = metrics;
+    hints->metrics      = metrics;
+    hints->scaler_flags = metrics->scaler.flags;
   }
 
 
@@ -520,7 +521,6 @@
     FT_Error   error   = AF_Err_Ok;
     AF_Point   points;
     FT_UInt    old_max, new_max;
-    AF_Scaler  scaler  = &hints->metrics->scaler;
     FT_Fixed   x_scale = hints->x_scale;
     FT_Fixed   y_scale = hints->y_scale;
     FT_Pos     x_delta = hints->x_delta;
@@ -528,7 +528,6 @@
     FT_Memory  memory  = hints->memory;
 
 
-    hints->scaler_flags = scaler->flags;
     hints->num_points   = 0;
     hints->num_contours = 0;
 
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1294,6 +1294,7 @@
                        AF_LatinMetrics  metrics )
   {
     FT_Render_Mode  mode;
+    FT_UInt32       scaler_flags, other_flags;
 
 
     af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics );
@@ -1308,10 +1309,10 @@
     hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;
 
     /* compute flags depending on render mode, etc... */
-
     mode = metrics->root.scaler.render_mode;
 
-    hints->other_flags = 0;
+    scaler_flags = hints->scaler_flags;
+    other_flags  = 0;
 
     /*
      *  We snap the width of vertical stems for the monochrome and
@@ -1318,7 +1319,7 @@
      *  horizontal LCD rendering targets only.
      */
     if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
-      hints->other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
+      other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
 
     /*
      *  We snap the width of horizontal stems for the monochrome and
@@ -1325,16 +1326,24 @@
      *  vertical LCD rendering targets only.
      */
     if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
-      hints->other_flags |= AF_LATIN_HINTS_VERT_SNAP;
+      other_flags |= AF_LATIN_HINTS_VERT_SNAP;
 
     /*
      *  We adjust stems to full pixels only if we don't use the `light' mode.
      */
     if ( mode != FT_RENDER_MODE_LIGHT )
-      hints->other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
+      other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
 
     if ( mode == FT_RENDER_MODE_MONO )
-      hints->other_flags |= AF_LATIN_HINTS_MONO;
+      other_flags |= AF_LATIN_HINTS_MONO;
+
+    /* in 'light' hinting mode, we disable horizontal hinting completely
+     */
+    if ( mode == FT_RENDER_MODE_LIGHT )
+      scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
+
+    hints->scaler_flags = scaler_flags;
+    hints->other_flags  = other_flags;
 
     return 0;
   }