Werner,

Making warping a normal option is not a big deal. See attached
patches. What do you think?

Alexei
diff --git a/ChangeLog b/ChangeLog
index cfc9bb0..8872cb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-02  Alexei Podtelezhnikov  <[email protected]>
+
+       [ftdiff, ftgrid, ftview] Make warping NORMAL option.
+
+       * src/ftdiff.c (render_state_draw, event_help): Updated.
+       * src/ftgrid.c (event_help, event_warping_change): Updated.
+       * src/ftview.c (event_help, event_warping_change, write_header):
+       Updated.
+
 2017-05-02  Werner Lemberg  <[email protected]>
 
        Remove `slight' auto-hinting mode.  Add sub-pixel `light' mode.
diff --git a/src/ftdiff.c b/src/ftdiff.c
index e320861..15a2228 100644
--- a/src/ftdiff.c
+++ b/src/ftdiff.c
@@ -832,7 +832,7 @@
           }
         }
       }
-      else if ( rmode == HINT_MODE_AUTOHINT_LIGHT )
+      else if ( rmode == HINT_MODE_AUTOHINT )
         extra = warping ? " (+warp)" : " (-warp)";
 
       sprintf( temp, "%s%s",
@@ -1138,7 +1138,7 @@
     grWriteln( "  d            toggle lsb/rsb deltas" );
     grWriteln( "  h            cycle hinting mode" );
     grWriteln( "  H            cycle hinting engine (if CFF or TTF)" );
-    grWriteln( "  w            toggle warping (if light auto-hinting" );
+    grWriteln( "  w            toggle warping (if normal auto-hinting" );
     grWriteln( "  k            toggle kerning (only from `kern' table)" );
     grWriteln( "  r            toggle rendering mode" );
     grWriteln( "  x            toggle layout mode" );
diff --git a/src/ftgrid.c b/src/ftgrid.c
index ce7a567..d642dc7 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -981,7 +981,7 @@
     grWriteln( "Up, Down    adjust size by 0.5pt        if not auto-hinting:   
             " );
     grWriteln( "                                          H         cycle 
through hinting   " );
     grWriteln( "Left, Right adjust index by 1                        engines 
(if available) " );
-    grWriteln( "F7, F8      adjust index by 10          if light auto-hinting: 
             " );
+    grWriteln( "F7, F8      adjust index by 10          if normal 
auto-hinting:             " );
     grWriteln( "F9, F10     adjust index by 100           w         toggle 
warping          " );
     grWriteln( "F11, F12    adjust index by 1000                      (if 
available)        " );
     grWriteln( "                                                               
             " );
@@ -1072,7 +1072,7 @@
   static void
   event_warping_change( void )
   {
-    if ( handle->lcd_mode == LCD_MODE_LIGHT )
+    if ( handle->lcd_mode == LCD_MODE_AA && handle->autohint )
     {
       FT_Bool  new_warping_state = !status.warping;
 
@@ -1095,7 +1095,7 @@
                                      : "warping disabled";
     }
     else
-      status.header = "need light anti-aliasing mode to toggle warping";
+      status.header = "need normal anti-aliasing mode to toggle warping";
   }
 
 
diff --git a/src/ftview.c b/src/ftview.c
index 730855c..ea65d11 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -775,8 +775,8 @@
     grWriteln( "             engines (if available)                            
             " );
     grWriteln( "f           toggle forced auto-         g, v        adjust 
gamma value      " );
     grWriteln( "             hinting (if hinting)                              
             " );
-    grWriteln( "w           toggle warping (in light    Tab         cycle 
through charmaps  " );
-    grWriteln( "             AA mode, if available)                            
             " );
+    grWriteln( "w           toggle warping              Tab         cycle 
through charmaps  " );
+    grWriteln( "             (if available)                                    
             " );
     grWriteln( "                                                               
             " );
     grWriteln( "                                        q, ESC      quit 
ftview             " );
     /*          |----------------------------------|    
|----------------------------------| */
@@ -848,7 +848,7 @@
   static int
   event_warping_change( void )
   {
-    if ( handle->lcd_mode == LCD_MODE_LIGHT )
+    if ( handle->lcd_mode == LCD_MODE_AA && handle->autohint )
     {
       FT_Bool  new_warping_state = !status.warping;
 
@@ -1730,7 +1730,7 @@
       }
     }
 
-    if ( handle->lcd_mode == LCD_MODE_LIGHT )
+    if ( handle->lcd_mode == LCD_MODE_AA && handle->autohint )
     {
       sprintf( buf, "warping: %s",
                     status.warping ? "on" : "off" );
diff --git a/ChangeLog b/ChangeLog
index 05fd0aa..b9fbeb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-05-02  Alexei Podtelezhnikov  <[email protected]>
+
+       [autofit] Make warping NORMAL option.
+
+       * 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-02  Behdad Esfahbod  <[email protected]>
 
        [truetype] Make `IUP' gvar deltas do the same as Apple (#50832).
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 61e29cd..897533d 100644
--- 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;
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 11fa523..cdbc1b7 100644
--- 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;
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index 0607278..fb42445 100644
--- 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;
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index ddf47eb..da13b09 100644
--- 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;
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to