[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 3bb512bc9f).

* 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.
This commit is contained in:
Alexei Podtelezhnikov 2020-08-05 08:24:15 -04:00
parent 3a1f4b7aaa
commit f9f6adb625
4 changed files with 29 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -92,6 +92,7 @@
base->outline.n_points = 0;
base->outline.n_contours = 0;
base->outline.flags = 0;
base->num_subglyphs = 0;
*current = *base;

View File

@ -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;
}
/***********************************************************************/