freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master f9f6adb: [truetype] Retain OVERLAP_SIMPLE and OVERLAP


From: Alexei Podtelezhnikov
Subject: [freetype2] master f9f6adb: [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
Date: Wed, 5 Aug 2020 08:28:18 -0400 (EDT)

branch: master
commit f9f6adb625c48ef15b5d61a3ac1709a068ea95a3
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
    
    For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
    FT_OUTLINE_OVERLAP to render them with direct oversampling, which
    mitigates artifacts (see 3bb512bc9f62).
    
    * include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme
    with OVERLAP_SIMPLE.
    * src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags.
    * src/truetype/ttgload.c
    (TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE.
    (load_truetype_glyph): Retain OVERLAP_COMPOUND.
---
 ChangeLog                  | 17 ++++++++++++++++-
 include/freetype/ftimage.h |  2 +-
 src/base/ftgloadr.c        |  1 +
 src/truetype/ttgload.c     | 13 +++++++++++--
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e5ac43..b118200 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-08-05  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
+
+       For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
+       FT_OUTLINE_OVERLAP to render them with direct oversampling, which
+       mitigates artifacts (see 3bb512bc9f62).
+
+       * include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme
+       with OVERLAP_SIMPLE.
+       * src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags.
+       * src/truetype/ttgload.c
+       (TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE.
+       (load_truetype_glyph): Retain OVERLAP_COMPOUND.
+
 2020-08-04  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
        * src/truetype/ttgload.c (TT_Load_Glyph): More tracing.
@@ -244,7 +259,7 @@
 
        [smooth] Introduce direct oversampling for overlaps.
 
-       This implements oversampling to metigate artifacts in pixels partially
+       This implements oversampling to mitigate artifacts in pixels partially
        covered by overlapping contours.  It turns out that the 4x4
        oversampling is sufficient but, at least, quadruples the rendering
        time.  The outline has to set FT_OUTLINE_OVERLAP to use this method.
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index 29b907a..105e09d 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -438,8 +438,8 @@ FT_BEGIN_HEADER
 #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
 #define FT_OUTLINE_SMART_DROPOUTS   0x10
 #define FT_OUTLINE_INCLUDE_STUBS    0x20
+#define FT_OUTLINE_OVERLAP          0x40
 
-#define FT_OUTLINE_OVERLAP          0x80
 #define FT_OUTLINE_HIGH_PRECISION   0x100
 #define FT_OUTLINE_SINGLE_PASS      0x200
 
diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c
index faf7d85..05fc769 100644
--- a/src/base/ftgloadr.c
+++ b/src/base/ftgloadr.c
@@ -92,6 +92,7 @@
 
     base->outline.n_points   = 0;
     base->outline.n_contours = 0;
+    base->outline.flags      = 0;
     base->num_subglyphs      = 0;
 
     *current = *base;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index d2d70a9..126c1e9 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -60,7 +60,7 @@
 #define SAME_X          0x10
 #define Y_POSITIVE      0x20  /* two meanings depending on Y_SHORT_VECTOR */
 #define SAME_Y          0x20
-#define OVERLAP_SIMPLE  0x40  /* we ignore this value                     */
+#define OVERLAP_SIMPLE  0x40  /* retained as FT_OUTLINE_OVERLAP           */
 
 
   /**************************************************************************
@@ -77,7 +77,7 @@
 #define WE_HAVE_A_2X2              0x0080
 #define WE_HAVE_INSTR              0x0100
 #define USE_MY_METRICS             0x0200
-#define OVERLAP_COMPOUND           0x0400  /* we ignore this value */
+#define OVERLAP_COMPOUND           0x0400  /* retained as FT_OUTLINE_OVERLAP */
 #define SCALED_COMPONENT_OFFSET    0x0800
 #define UNSCALED_COMPONENT_OFFSET  0x1000
 
@@ -489,6 +489,10 @@
       }
     }
 
+    /* retain the overlap flag */
+    if ( n_points && outline->tags[0] & OVERLAP_SIMPLE )
+      gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
+
     /* reading the X coordinates */
 
     vec       = outline->points;
@@ -2183,6 +2187,11 @@
             goto Exit;
         }
       }
+
+      /* retain the overlap flag */
+      if ( gloader->base.num_subglyphs                         &&
+           gloader->base.subglyphs[0].flags & OVERLAP_COMPOUND )
+        gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
     }
 
     /***********************************************************************/



reply via email to

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