freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] Harmony 66006db: [autofit] Handle LCD lightly.


From: Alexei Podtelezhnikov
Subject: [freetype2] Harmony 66006db: [autofit] Handle LCD lightly.
Date: Sun, 2 Apr 2017 22:32:25 -0400 (EDT)

branch: Harmony
commit 66006dbfa4b45b6d5d1ae3ff7eaa49f7a2d40729
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [autofit] Handle LCD lightly.
    
    This commit explicitly disables stem adjustment and metrics changes
    for FT_LOAD_TARGET_LCD, redoing the last commit.
    
    * include/freetype/freetype.h (FT_LOAD_TARGET_XXX): Docs updated.
    * src/autofit/afcjk.c (af_cjk_hints_init): Updated.
    * src/autofit/aflatin.c (af_latin_hints_init): Updated.
    * src/autofit/aflatin2.c (af_latin2_hints_init): Updated.
---
 ChangeLog              | 12 ++++++++++++
 src/autofit/afcjk.c    | 21 +++++++++++----------
 src/autofit/aflatin.c  | 27 ++++++++++++++-------------
 src/autofit/aflatin2.c | 30 ++++++++++++++----------------
 4 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 494684c..fae5e1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-04-02  Alexei Podtelezhnikov  <address@hidden>
+
+       [autofit] Handle LCD lightly.
+
+       This commit explicitly disables stem adjustment and metrics changes
+       for FT_LOAD_TARGET_LCD, redoing the last commit.
+
+       * include/freetype/freetype.h (FT_LOAD_TARGET_XXX): Docs updated.
+       * src/autofit/afcjk.c (af_cjk_hints_init): Updated.
+       * src/autofit/aflatin.c (af_latin_hints_init): Updated.
+       * src/autofit/aflatin2.c (af_latin2_hints_init): Updated.
+
 2017-03-30  Alexei Podtelezhnikov  <address@hidden>
 
        [autofit] LCD equals LIGHT, LCD_V equals NORMAL.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 5c5dadd..c828e25 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1375,31 +1375,32 @@
     /* compute flags depending on render mode, etc. */
     mode = metrics->root.scaler.render_mode;
 
-    if ( mode == FT_RENDER_MODE_LCD )
-      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_LIGHT;
-
-    if ( mode == FT_RENDER_MODE_LCD_V )
+#if 0 /* AF_CONFIG_OPTION_USE_WARPER */
+    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
       metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
 
     scaler_flags = hints->scaler_flags;
     other_flags  = 0;
 
     /*
-     *  We snap the width of vertical stems for the monochrome target only.
+     *  We snap the width of vertical stems for the monochrome and
+     *  horizontal LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
 
     /*
-     *  We snap the width of horizontal stems for the monochrome target only.
+     *  We snap the width of horizontal stems for the monochrome and
+     *  vertical LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
       other_flags |= AF_LATIN_HINTS_VERT_SNAP;
 
     /*
-     *  We adjust stems to full pixels only if we don't use the `light' mode.
+     *  We adjust stems to full pixels unless in `light' or `lcd' mode.
      */
-    if ( mode != FT_RENDER_MODE_LIGHT )
+    if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
 
     if ( mode == FT_RENDER_MODE_MONO )
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 5560979..11fa523 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2552,45 +2552,46 @@
     /* compute flags depending on render mode, etc. */
     mode = metrics->root.scaler.render_mode;
 
-    if ( mode == FT_RENDER_MODE_LCD )
-      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_LIGHT;
-
-    if ( mode == FT_RENDER_MODE_LCD_V )
+#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
+    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
       metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
 
     scaler_flags = hints->scaler_flags;
     other_flags  = 0;
 
     /*
-     *  We snap the width of vertical stems for the monochrome target only.
+     *  We snap the width of vertical stems for the monochrome and
+     *  horizontal LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
 
     /*
-     *  We snap the width of horizontal stems for the monochrome target only.
+     *  We snap the width of horizontal stems for the monochrome and
+     *  vertical LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
       other_flags |= AF_LATIN_HINTS_VERT_SNAP;
 
     /*
-     *  We adjust stems to full pixels only if we don't use the `light' mode.
+     *  We adjust stems to full pixels unless in `light' or `lcd' mode.
      */
-    if ( mode != FT_RENDER_MODE_LIGHT )
+    if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
 
     if ( mode == FT_RENDER_MODE_MONO )
       other_flags |= AF_LATIN_HINTS_MONO;
 
     /*
-     *  In `light' hinting mode we disable horizontal hinting completely.
+     *  In `light' or `lcd' mode we disable horizontal hinting completely.
      *  We also do it if the face is italic.
      *
      *  However, if warping is enabled (which only works in `light' hinting
      *  mode), advance widths get adjusted, too.
      */
-    if ( mode == FT_RENDER_MODE_LIGHT                      ||
-         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
+    if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD ||
+         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0          )
       scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
 
 #ifdef AF_CONFIG_OPTION_USE_WARPER
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index d2addd5..5cfc25d 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -1532,45 +1532,43 @@
     /* compute flags depending on render mode, etc. */
     mode = metrics->root.scaler.render_mode;
 
-    if ( mode == FT_RENDER_MODE_LCD )
-      metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_LIGHT;
-
-    if ( mode == FT_RENDER_MODE_LCD_V )
+#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
+    if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
       metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
+#endif
 
     scaler_flags = hints->scaler_flags;
     other_flags  = 0;
 
     /*
-     *  We snap the width of vertical stems for the monochrome target only.
+     *  We snap the width of vertical stems for the monochrome and
+     *  horizontal LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
 
     /*
-     *  We snap the width of horizontal stems for the monochrome target only.
+     *  We snap the width of horizontal stems for the monochrome and
+     *  vertical LCD rendering targets only.
      */
-    if ( mode == FT_RENDER_MODE_MONO )
+    if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
       other_flags |= AF_LATIN_HINTS_VERT_SNAP;
 
     /*
-     *  We adjust stems to full pixels only if we don't use the `light' mode.
+     *  We adjust stems to full pixels unless in `light' or `lcd' mode.
      */
-    if ( mode != FT_RENDER_MODE_LIGHT )
+    if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD )
       other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
 
     if ( mode == FT_RENDER_MODE_MONO )
       other_flags |= AF_LATIN_HINTS_MONO;
 
     /*
-     *  In `light' hinting mode we disable horizontal hinting completely.
+     *  In `light' or `lcd' mode we disable horizontal hinting completely.
      *  We also do it if the face is italic.
-     *
-     *  However, if warping is enabled (which only works in `light' hinting
-     *  mode), advance widths get adjusted, too.
      */
-    if ( mode == FT_RENDER_MODE_LIGHT                      ||
-         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
+    if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD ||
+         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0          )
       scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
 
 #ifdef AF_CONFIG_OPTION_USE_WARPER



reply via email to

[Prev in Thread] Current Thread [Next in Thread]