[truetype] Adjust subpixel zp2 moves and tweak rules.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
diff --git a/ChangeLog b/ChangeLog
index 310703b..436ecff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-05-22 Infinality <infinality@infinality.net>
+
+ [truetype] Adjust subpixel zp2 moves and tweak rules.
+
+ These modifications fix thin diagonal stems in some legacy fonts.
+
+ * src/truetype/ttinterp.c (Direct_Move_X): Remove unused macro.
+ (Move_Zp2_Point): Don't always disable x moves for subpixel rendering.
+ (Ins_SHP): Disable x moves here for subpixel rendering.
+ (Ins_SHPIX): Only disable x moves in compatibility mode.
+ Split out zp2 move reversals and reorder conditional respectively.
+
+ * src/truetype/ttsubpix.c (SKIP_NONPIXEL_Y_MOVES_Rules): Fix oversight.
+ Only adjust Verdana clones for 17 ppem.
+ (SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions): Add Courier New.
+ (ALWAYS_SKIP_DELTAP_Rules): Found additional cases for Arial `s'.
+
2013-05-20 Infinality <infinality@infinality.net>
[truetype] Simplify and improve subpixel function detection.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 437db22..0cd869d 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -5825,12 +5825,7 @@
if ( CUR.GS.freeVector.x != 0 )
{
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
- if ( !SUBPIXEL_HINTING ||
- !CUR.ignore_x_mode )
-#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
- CUR.zp2.cur[point].x += dx;
-
+ CUR.zp2.cur[point].x += dx;
if ( touch )
CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
}
@@ -5887,6 +5882,13 @@
}
}
else
+#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
+ /* doesn't follow Cleartype spec but produces better result */
+ if ( SUBPIXEL_HINTING &&
+ CUR.ignore_x_mode )
+ MOVE_Zp2_Point( point, 0, dy, TRUE );
+ else
+#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
MOVE_Zp2_Point( point, dx, dy, TRUE );
CUR.GS.loop--;
@@ -6080,15 +6082,22 @@
if ( !CUR.face->sph_compatibility_mode &&
CUR.GS.freeVector.y != 0 )
- MOVE_Zp2_Point( point, dx, dy, TRUE );
-
- else if ( CUR.sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
{
MOVE_Zp2_Point( point, dx, dy, TRUE );
- /* don't allow reversals */
- goto Skip;
- }
+ /* save new point */
+ if ( CUR.GS.freeVector.y != 0 )
+ {
+ B2 = CUR.zp2.cur[point].y;
+
+ /* reverse any disallowed moves */
+ if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
+ ( B1 & 63 ) != 0 &&
+ ( B2 & 63 ) != 0 &&
+ B1 != B2 )
+ MOVE_Zp2_Point( point, -dx, -dy, TRUE );
+ }
+ }
else if ( CUR.face->sph_compatibility_mode )
{
if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
@@ -6107,27 +6116,22 @@
( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) ||
( CUR.zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ||
( CUR.sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) )
- MOVE_Zp2_Point( point, dx, dy, TRUE );
- }
+ MOVE_Zp2_Point( point, 0, dy, TRUE );
- /* save new point */
- if ( CUR.GS.freeVector.y != 0 )
- B2 = CUR.zp2.cur[point].y;
- else
- B2 = CUR.zp2.cur[point].x;
-
- /* reverse any disallowed moves */
- if ( ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
- CUR.GS.freeVector.y != 0 &&
- ( B1 & 63 ) != 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 ) ||
- ( CUR.face->sph_compatibility_mode &&
- CUR.GS.freeVector.y != 0 &&
- ( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 ) )
- MOVE_Zp2_Point( point, -dx, -dy, TRUE );
+ /* save new point */
+ if ( CUR.GS.freeVector.y != 0 )
+ {
+ B2 = CUR.zp2.cur[point].y;
+
+ /* reverse any disallowed moves */
+ if ( ( B1 & 63 ) == 0 &&
+ ( B2 & 63 ) != 0 &&
+ B1 != B2 )
+ MOVE_Zp2_Point( point, 0, -dy, TRUE );
+ }
+ }
+ else if ( CUR.sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
+ MOVE_Zp2_Point( point, dx, dy, TRUE );
}
else
MOVE_Zp2_Point( point, dx, dy, TRUE );
diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c
index 8310b33..28e0e58 100644
--- a/src/truetype/ttsubpix.c
+++ b/src/truetype/ttsubpix.c
@@ -310,19 +310,19 @@
/* Skip Y moves that start with a point that is not on a Y pixel */
/* boundary and don't move that point to a Y pixel boundary. */
-#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 5
+#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 4
const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules
[SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =
{
/* fix vwxyz thinness*/
- { "Consolas", 0, "", 0 }, { "-", 0, "N", 0 },
+ { "Consolas", 0, "", 0 },
/* Fix thin middle stems */
- { "-Core MS Legacy Fonts", 0, "Regular/Bold Class", 0 },
+ { "Core MS Legacy Fonts", 0, "Regular", 0 },
/* Cyrillic small letter I */
{ "Legacy Sans Fonts", 0, "", 0 },
/* Fix artifacts with some Regular & Bold */
- { "Verdana Clones", 0, "", 0 },
+ { "Verdana Clones", 17, "", 0 },
};
@@ -331,7 +331,8 @@
const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions
[SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
{
- { "-", 0, "", 0 },
+ /* Fixes < and > */
+ { "Courier New", 0, "Regular", 0 },
};
@@ -450,7 +451,7 @@
/* Skip DELTAP instructions if matched. */
-#define ALWAYS_SKIP_DELTAP_RULES_SIZE 18
+#define ALWAYS_SKIP_DELTAP_RULES_SIZE 23
const SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules
[ALWAYS_SKIP_DELTAP_RULES_SIZE] =
@@ -473,10 +474,15 @@
{ "Arial", 10, "Regular", '6' },
{ "Arial", 0, "Bold/BoldItalic Class", 'a' },
/* Make horizontal stems consistent with the rest */
- { "Arial", 24, "Bold", 's' },
- { "Arial", 25, "Bold", 's' },
{ "Arial", 24, "Bold", 'a' },
{ "Arial", 25, "Bold", 'a' },
+ { "Arial", 24, "Bold", 's' },
+ { "Arial", 25, "Bold", 's' },
+ { "Arial", 34, "Bold", 's' },
+ { "Arial", 35, "Bold", 's' },
+ { "Arial", 36, "Bold", 's' },
+ { "Arial", 25, "Regular", 's' },
+ { "Arial", 26, "Regular", 's' },
};