shithub: freetype+ttf2subf

Download patch

ref: a7f276a281b2741b14beadb00f5d8414c464e07c
parent: e99b26aadae8fa057debf995e4b8017e18c2b995
author: Alexei Podtelezhnikov <[email protected]>
date: Sun May 14 20:25:37 EDT 2017

[autofit] Make autohint warping NORMAL option.

This moves warping option from LIGHT to NORMAL mode.  This makes LIGHT
truly void of hinting in x-direction, with left side bearing never
changed and right side bearing only altered by advance rounding.
Therefore, LIGHT is now ready to return fractional advance.  As a
NORMAL option, warping substitutes normal hinting.

* src/autofit/afcjk.c (af_cjk_hints_apply): Updated.
* src/autofit/aflatin.c (af_latin_hints_apply): Updated.
* src/autofit/aflatin2.c (af_latin2_hints_apply): Updated.

* src/autofit/afloader.c (af_loader_load_glyph): Handle warping
phantom points as normal.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2017-05-15  Alexei Podtelezhnikov  <[email protected]>
+
+	[autofit] Make autohint warping NORMAL option.
+
+	This moves warping option from LIGHT to NORMAL mode.  This makes LIGHT
+	truly void of hinting in x-direction, with left side bearing never
+	changed and right side bearing only altered by advance rounding.
+	Therefore, LIGHT is now ready to return fractional advance.  As a
+	NORMAL option, warping substitutes normal hinting.
+
+	* src/autofit/afcjk.c (af_cjk_hints_apply): Updated.
+	* src/autofit/aflatin.c (af_latin_hints_apply): Updated.
+	* src/autofit/aflatin2.c (af_latin2_hints_apply): Updated.
+
+	* src/autofit/afloader.c (af_loader_load_glyph): Handle warping
+	phantom points as normal.
+
 2017-05-14  Werner Lemberg  <[email protected]>
 
 	Remove remnants of raster pool.
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -2272,13 +2272,7 @@
       goto Exit;
 
     /* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
-    if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-           AF_HINTS_DO_WARP( hints )                                ) ||
-         AF_HINTS_DO_HORIZONTAL( hints )                              )
-#else
     if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
     {
       error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ );
       if ( error )
@@ -2304,9 +2298,9 @@
       {
 
 #ifdef AF_CONFIG_OPTION_USE_WARPER
-        if ( dim == AF_DIMENSION_HORZ                                 &&
-             metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-             AF_HINTS_DO_WARP( hints )                                )
+        if ( dim == AF_DIMENSION_HORZ                                  &&
+             metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+             AF_HINTS_DO_WARP( hints )                                 )
         {
           AF_WarperRec  warper;
           FT_Fixed      scale;
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -3492,13 +3492,7 @@
       goto Exit;
 
     /* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
-    if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-           AF_HINTS_DO_WARP( hints )                                ) ||
-         AF_HINTS_DO_HORIZONTAL( hints )                              )
-#else
     if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
     {
       axis  = &metrics->axis[AF_DIMENSION_HORZ];
       error = af_latin_hints_detect_features( hints,
@@ -3528,9 +3522,9 @@
     for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
     {
 #ifdef AF_CONFIG_OPTION_USE_WARPER
-      if ( dim == AF_DIMENSION_HORZ                                 &&
-           metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-           AF_HINTS_DO_WARP( hints )                                )
+      if ( dim == AF_DIMENSION_HORZ                                  &&
+           metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+           AF_HINTS_DO_WARP( hints )                                 )
       {
         AF_WarperRec  warper;
         FT_Fixed      scale;
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -2340,13 +2340,7 @@
       goto Exit;
 
     /* analyze glyph outline */
-#ifdef AF_CONFIG_OPTION_USE_WARPER
-    if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-           AF_HINTS_DO_WARP( hints )                                ) ||
-         AF_HINTS_DO_HORIZONTAL( hints )                              )
-#else
     if ( AF_HINTS_DO_HORIZONTAL( hints ) )
-#endif
     {
       error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ );
       if ( error )
@@ -2366,9 +2360,9 @@
     for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
     {
 #ifdef AF_CONFIG_OPTION_USE_WARPER
-      if ( dim == AF_DIMENSION_HORZ                                 &&
-           metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
-           AF_HINTS_DO_WARP( hints )                                )
+      if ( dim == AF_DIMENSION_HORZ                                  &&
+           metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL &&
+           AF_HINTS_DO_WARP( hints )                                 )
       {
         AF_WarperRec  warper;
         FT_Fixed      scale;
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -483,8 +483,8 @@
           FT_Pos  pp2x = loader->pp2.x;
 
 
-          loader->pp1.x = FT_PIX_ROUND( pp1x );
-          loader->pp2.x = FT_PIX_ROUND( pp2x );
+          loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
+          loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
 
           slot->lsb_delta = loader->pp1.x - pp1x;
           slot->rsb_delta = loader->pp2.x - pp2x;
@@ -498,8 +498,8 @@
         FT_Pos  pp2x = loader->pp2.x;
 
 
-        loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
-        loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
+        loader->pp1.x = FT_PIX_ROUND( pp1x );
+        loader->pp2.x = FT_PIX_ROUND( pp2x );
 
         slot->lsb_delta = loader->pp1.x - pp1x;
         slot->rsb_delta = loader->pp2.x - pp2x;