diff --git a/ChangeLog b/ChangeLog index dcf35f55c..310703b9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2013-05-20 Infinality + + [truetype] Simplify and improve subpixel function detection. + + Some small enhancements have allowed the removal of many macros and + the simplification of existing rules in `ttsubpix.c'. + + * src/truetype/ttsubpix.h (SPH_TWEAK_ALLOW_X_DMOVEX, + SPH_TWEAK_ALLOW_X_MOVE_ZP2, + SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES, + SPH_TWEAK_SKIP_INLINE_DELTAS, SPH_TWEAK_MIRP_CVT_ZERO): Removed. + (SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP): New rule macro. + + * src/truetype/ttsubpix.c: Updated affected rules. + + * src/truetype/ttinterp.c (Direct_Move_X): Updated. + (INS_FDEF): Add additional function detection. + (INS_ENDF): Set runtime flag. + (Ins_CALL): Skip the call under certain conditions. + Remove bad code. + (Ins_LOOPCALL): Skip the call under certain conditions. + Remove bad code. + (Move_Zp2_Point): Updated. + (Ins_SHPIX): Updated. + Skip the move under some situations. + (Ins_MIAP): Improve conditions. + (Ins_MIRP): Updated. + (Ins_DELTAP): Skip move under certain conditions. + Simplify conditions. + (TT_RunIns): Updated. + Add code to handle new function detection. + Trace messages. + 2013-05-17 Werner Lemberg Update more FT_Err_XXX macros using FT_ERR and FT_THROW; diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 2e9cf6452..437db2294 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -1849,9 +1849,8 @@ FT_UNUSED_EXEC; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !SUBPIXEL_HINTING || - ( !CUR.ignore_x_mode || - ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) ) ) + if ( !SUBPIXEL_HINTING || + !CUR.ignore_x_mode ) #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ zone->cur[point].x += distance; @@ -4474,7 +4473,7 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING /* arguments to opcodes are skipped by `SKIP_Code' */ - FT_Byte opcode_pattern[7][12] = { + FT_Byte opcode_pattern[9][12] = { /* #0 inline delta function 1 */ { 0x4B, /* PPEM */ @@ -4552,10 +4551,23 @@ 0x43, /* RS */ 0x58 /* IF */ }, + /* #7 TypeMan Talk DiagEndCtrl function */ + { + 0x01, /* SVTCA_x */ + 0x20, /* DUP */ + 0xB0, /* PUSHB_1 */ + /* 3 */ + 0x25, /* CINDEX */ + }, + /* #8 TypeMan Talk Align */ + { + 0x06, /* SPVTL */ + 0x7D, /* RDTG */ + }, }; - FT_UShort opcode_patterns = 7; - FT_UShort opcode_pointer[7] = { 0, 0, 0, 0, 0, 0, 0 }; - FT_UShort opcode_size[7] = { 12, 8, 8, 6, 7, 4, 5 }; + FT_UShort opcode_patterns = 9; + FT_UShort opcode_pointer[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FT_UShort opcode_size[9] = { 12, 8, 8, 6, 7, 4, 5, 4, 2 }; FT_UShort i; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -4697,6 +4709,18 @@ CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_2; } break; + + case 7: + rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + break; + + case 8: +#if 0 + rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; +#endif + break; } opcode_pointer[i] = 0; } @@ -4743,6 +4767,10 @@ FT_UNUSED_ARG; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + CUR.sph_in_func_flags = 0x0000; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + if ( CUR.callTop <= 0 ) /* We encountered an ENDF without a call */ { CUR.error = FT_THROW( ENDF_In_Exec_Stream ); @@ -4828,7 +4856,14 @@ goto Fail; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - CUR.sph_in_func_flags &= def->sph_fdef_flags; + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + ( ( CUR.iup_called && + ( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) || + ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) ) + goto Fail; + else + CUR.sph_in_func_flags = def->sph_fdef_flags; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ /* check the call stack */ @@ -4853,10 +4888,6 @@ CUR.step_ins = FALSE; -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - CUR.sph_in_func_flags &= !def->sph_fdef_flags; -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - return; Fail: @@ -4914,7 +4945,12 @@ goto Fail; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - CUR.sph_in_func_flags &= def->sph_fdef_flags; + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) + goto Fail; + else + CUR.sph_in_func_flags = def->sph_fdef_flags; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ /* check stack */ @@ -4941,10 +4977,6 @@ CUR.step_ins = FALSE; } -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - CUR.sph_in_func_flags &= !def->sph_fdef_flags; -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - return; Fail: @@ -5794,10 +5826,8 @@ if ( CUR.GS.freeVector.x != 0 ) { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !SUBPIXEL_HINTING || - ( !CUR.ignore_x_mode || - ( CUR.ignore_x_mode && - ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_MOVE_ZP2 ) ) ) ) + if ( !SUBPIXEL_HINTING || + !CUR.ignore_x_mode ) #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ CUR.zp2.cur[point].x += dx; @@ -6048,14 +6078,17 @@ else B1 = CUR.zp2.cur[point].x; - if ( CUR.GS.freeVector.y != 0 && - ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_INLINE_DELTAS ) ) - goto Skip; - 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; + } + else if ( CUR.face->sph_compatibility_mode ) { if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) @@ -6064,6 +6097,12 @@ dy = FT_PIX_ROUND( B1 + dy ) - B1; } + /* skip post-iup deltas */ + if ( CUR.iup_called && + ( ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || + ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) + goto Skip; + if ( !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && ( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) || ( CUR.zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || @@ -6253,6 +6292,7 @@ if ( SUBPIXEL_HINTING && CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 && + CUR.GS.freeVector.y == 0 && !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) control_value_cutin = 0; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -6527,13 +6567,6 @@ else cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 ); -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( SUBPIXEL_HINTING && - CUR.ignore_x_mode && - ( CUR.sph_tweak_flags & SPH_TWEAK_MIRP_CVT_ZERO ) ) - cvt_dist = 0; -#endif - /* single width test */ if ( FT_ABS( cvt_dist - CUR.GS.single_width_value ) < @@ -6689,12 +6722,6 @@ ( B2 & 63 ) != 0 && ( B1 & 63 ) != 0 ) reverse_move = TRUE; - - if ( ( CUR.sph_tweak_flags & - SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES ) && - !reverse_move && - FT_ABS( B1 - B2 ) >= 64 ) - reverse_move = TRUE; } if ( reverse_move ) @@ -7264,7 +7291,7 @@ if ( SUBPIXEL_HINTING && CUR.ignore_x_mode ) { - CUR.iup_called = 1; + CUR.iup_called = TRUE; if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP ) return; } @@ -7341,7 +7368,14 @@ FT_Long B; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING FT_UShort B1, B2; -#endif + + + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.iup_called && + ( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) + goto Fail; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -7445,7 +7479,7 @@ /* Standard Subpixel Hinting: Allow y move. */ /* This messes up dejavu and may not be needed... */ if ( !CUR.face->sph_compatibility_mode && - CUR.GS.freeVector.y != 0 ) + CUR.GS.freeVector.y != 0 ) CUR_Func_move( &CUR.zp0, A, B ); else #endif /* 0 */ @@ -7471,14 +7505,14 @@ B2 = CUR.zp0.cur[A].y; /* Reverse this move if it results in a disallowed move */ - if ( CUR.GS.freeVector.y != 0 && - ( ( CUR.face->sph_compatibility_mode && - ( B1 & 63 ) == 0 && - ( B2 & 63 ) != 0 ) || - ( ( CUR.sph_tweak_flags & - SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - ( B1 & 63 ) != 0 && - ( B2 & 63 ) != 0 ) ) ) + if ( CUR.GS.freeVector.y != 0 && + ( ( CUR.face->sph_compatibility_mode && + ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 ) || + ( ( CUR.sph_tweak_flags & + SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 ) ) ) CUR_Func_move( &CUR.zp0, A, -B ); } } @@ -8098,6 +8132,20 @@ { FT_Long ins_counter = 0; /* executed instructions counter */ +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_Byte opcode_pattern[1][2] = { + /* #8 TypeMan Talk Align */ + { + 0x06, /* SPVTL */ + 0x7D, /* RDTG */ + }, + }; + FT_UShort opcode_patterns = 1; + FT_UShort opcode_pointer[1] = { 0 }; + FT_UShort opcode_size[1] = { 1 }; + FT_UShort i; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + #ifdef TT_CONFIG_OPTION_STATIC_RASTER cur = *exc; @@ -8153,9 +8201,6 @@ /* One can also interpret it as the index of the last argument. */ if ( CUR.args < 0 ) { - FT_UShort i; - - if ( CUR.pedantic_hinting ) { CUR.error = FT_THROW( Too_Few_Arguments ); @@ -8182,6 +8227,39 @@ CUR.step_ins = TRUE; CUR.error = FT_Err_Ok; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + + if ( SUBPIXEL_HINTING ) + { + for ( i = 0; i < opcode_patterns; i++ ) + { + if ( opcode_pointer[i] < opcode_size[i] && + CUR.opcode == opcode_pattern[i][opcode_pointer[i]] ) + { + opcode_pointer[i] += 1; + + if ( opcode_pointer[i] == opcode_size[i] ) + { + FT_TRACE7(( "sph: opcode ptrn: %d, %s %s\n", + i, + CUR.face->root.family_name, + CUR.face->root.style_name )); + + switch ( i ) + { + case 0: + break; + } + opcode_pointer[i] = 0; + } + } + else + opcode_pointer[i] = 0; + } + } + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + #ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH { @@ -8378,15 +8456,7 @@ break; case 0x2B: /* CALL */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !SUBPIXEL_HINTING || - ( !CUR.ignore_x_mode || - !CUR.iup_called || - ( CUR.iup_called && - !( CUR.sph_tweak_flags & - SPH_TWEAK_NO_CALL_AFTER_IUP ) ) ) ) -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_CALL( EXEC_ARG_ args ); + Ins_CALL( EXEC_ARG_ args ); break; case 0x2C: /* FDEF */ @@ -8404,12 +8474,6 @@ case 0x30: /* IUP */ case 0x31: /* IUP */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( SUBPIXEL_HINTING && - CUR.ignore_x_mode ) - CUR.iup_called = TRUE; -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_IUP( EXEC_ARG_ args ); break; @@ -8569,15 +8633,7 @@ break; case 0x5D: /* DELTAP1 */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !SUBPIXEL_HINTING || - ( !CUR.ignore_x_mode || - !CUR.iup_called || - ( CUR.iup_called && - !( CUR.sph_tweak_flags & - SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) ) ) -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_DELTAP( EXEC_ARG_ args ); + Ins_DELTAP( EXEC_ARG_ args ); break; case 0x5E: /* SDB */ diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index af57b9c21..8310b338d 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -287,25 +287,14 @@ /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting. */ -#define PIXEL_HINTING_RULES_SIZE 1 +#define PIXEL_HINTING_RULES_SIZE 2 const SPH_TweakRule PIXEL_HINTING_Rules [PIXEL_HINTING_RULES_SIZE] = { /* these characters are almost always safe */ - { "-", 0, "", 0 }, - }; - - - /* According to Greg Hitchcock and the MS whitepaper, this should work */ - /* on all legacy MS fonts, but creates artifacts with some. Only using */ - /* where absolutely necessary. */ -#define SKIP_INLINE_DELTAS_RULES_SIZE 1 - - const SPH_TweakRule SKIP_INLINE_DELTAS_Rules - [SKIP_INLINE_DELTAS_RULES_SIZE] = - { - { "-", 0, "", 0 }, + { "Courier New", 12, "Italic", 'z' }, + { "Courier New", 11, "Italic", 'z' }, }; @@ -321,42 +310,41 @@ /* 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 9 +#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 5 const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] = { /* fix vwxyz thinness*/ - { "Consolas", 0, "Regular", 0 }, - /* fix tiny gap at top of m */ - { "Arial", 0, "Regular", 'm' }, + { "Consolas", 0, "", 0 }, { "-", 0, "N", 0 }, /* Fix thin middle stems */ - { "Core MS Legacy Fonts", 0, "Regular/Bold Class", 'N' }, - { "Lucida Grande", 0, "", 'N' }, - { "Lucida Grande", 0, "Bold", 'y' }, + { "-Core MS Legacy Fonts", 0, "Regular/Bold Class", 0 }, /* Cyrillic small letter I */ - { "Legacy Sans Fonts", 0, "", 0x438 }, - { "Verdana Clones", 0, "",'N' }, - /* Fix misshapen x */ - { "Verdana", 0, "Bold", 'x' }, - /* Fix misshapen s */ - { "Tahoma", 0, "", 's' }, + { "Legacy Sans Fonts", 0, "", 0 }, + /* Fix artifacts with some Regular & Bold */ + { "Verdana Clones", 0, "", 0 }, }; -#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 7 +#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = { - { "Tahoma", 0, "", 'N' }, - { "Comic Sans MS", 0, "", 'N' }, - { "Verdana", 0, "Regular/Bold Class", 'N' }, - { "Verdana", 11, "Bold", 'x' }, - /* Cyrillic small letter I */ - { "Arial", 0, "", 0x438 }, - { "Arial", 11, "Bold", 'N' }, - { "Trebuchet MS", 0, "Bold", 0 }, + { "-", 0, "", 0 }, + }; + + + /* 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_DELTAP_RULES_SIZE 2 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_DELTAP_Rules + [SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE] = + { + /* Maintain thickness of diagonal in 'N' */ + { "Times New Roman", 0, "Regular/Bold Class", 'N' }, + { "Georgia", 0, "Regular/Bold Class", 'N' }, }; @@ -400,16 +388,6 @@ }; - /* Allow a Direct_Move_X along X freedom vector if matched. */ -#define ALLOW_X_DMOVEX_RULES_SIZE 1 - - const SPH_TweakRule ALLOW_X_DMOVEX_Rules - [ALLOW_X_DMOVEX_RULES_SIZE] = - { - { "-", 0, "Regular", 0 }, - }; - - /* Allow a Direct_Move along X freedom vector if matched. */ #define ALLOW_X_DMOVE_RULES_SIZE 1 @@ -421,17 +399,6 @@ }; - /* Allow a ZP2 move along freedom vector if matched; */ - /* This is called from SHP, SHPIX, SHC, SHZ. */ -#define ALLOW_X_MOVE_ZP2_RULES_SIZE 1 - - const SPH_TweakRule ALLOW_X_MOVE_ZP2_Rules - [ALLOW_X_MOVE_ZP2_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - /* Return MS rasterizer version 35 if matched. */ #define RASTERIZER_35_RULES_SIZE 8 @@ -456,7 +423,8 @@ const SPH_TweakRule NORMAL_ROUND_Rules [NORMAL_ROUND_RULES_SIZE] = { - /* Fix serif thickness */ + /* Fix serif thickness for certain ppems */ + /* Can probably be generalized somehow */ { "Courier New", 0, "", 0 }, }; @@ -482,7 +450,7 @@ /* Skip DELTAP instructions if matched. */ -#define ALWAYS_SKIP_DELTAP_RULES_SIZE 15 +#define ALWAYS_SKIP_DELTAP_RULES_SIZE 18 const SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules [ALWAYS_SKIP_DELTAP_RULES_SIZE] = @@ -492,7 +460,11 @@ { "Trebuchet MS", 14, "Regular", 'e' }, { "Trebuchet MS", 13, "Regular", 'e' }, { "Trebuchet MS", 15, "Regular", 'e' }, + { "Trebuchet MS", 0, "Italic", 'v' }, + { "Trebuchet MS", 0, "Italic", 'w' }, + { "Trebuchet MS", 0, "Regular", 'Y' }, { "Arial", 11, "Regular", 's' }, + /* prevent problems with '3' and others */ { "Verdana", 10, "Regular", 0 }, { "Verdana", 9, "Regular", 0 }, /* Cyrillic small letter short I */ @@ -509,57 +481,23 @@ /* Always do DELTAP instructions if matched. */ -#define ALWAYS_DO_DELTAP_RULES_SIZE 2 +#define ALWAYS_DO_DELTAP_RULES_SIZE 1 const SPH_TweakRule ALWAYS_DO_DELTAP_Rules [ALWAYS_DO_DELTAP_RULES_SIZE] = - { - { "Verdana Clones", 17, "Regular Class", 'K' }, - { "Verdana Clones", 17, "Regular Class", 'k' }, - }; - - - /* Do an extra RTG instruction in DELTAP if matched. */ -#define DELTAP_RTG_RULES_SIZE 1 - - static const SPH_TweakRule DELTAP_RTG_Rules - [DELTAP_RTG_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Force CVT distance to zero in MIRP. */ -#define MIRP_CVT_ZERO_RULES_SIZE 1 - - static const SPH_TweakRule MIRP_CVT_ZERO_Rules - [MIRP_CVT_ZERO_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Skip moves that meet or exceed 1 pixel. */ -#define DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE 1 - - static const SPH_TweakRule DELTAP_SKIP_EXAGGERATED_VALUES_Rules - [DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE] = { { "-", 0, "", 0 }, }; /* Don't allow ALIGNRP after IUP. */ -#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 4 +#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 1 static const SPH_TweakRule NO_ALIGNRP_AFTER_IUP_Rules [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] = { /* Prevent creation of dents in outline */ - { "Courier New", 0, "Bold", 'C' }, - { "Courier New", 0, "Bold", 'D' }, - { "Courier New", 0, "Bold", 'Q' }, - { "Courier New", 0, "Bold", '0' }, + { "-", 0, "", 0 }, }; @@ -574,16 +512,13 @@ /* Don't allow CALL after IUP. */ -#define NO_CALL_AFTER_IUP_RULES_SIZE 4 +#define NO_CALL_AFTER_IUP_RULES_SIZE 1 static const SPH_TweakRule NO_CALL_AFTER_IUP_Rules [NO_CALL_AFTER_IUP_RULES_SIZE] = { /* Prevent creation of dents in outline */ - { "Courier New", 0, "Bold", 'O' }, - { "Courier New", 0, "Bold", 'Q' }, - { "Courier New", 0, "Bold", 'k' }, - { "Courier New", 0, "Bold Italic", 'M' }, + { "-", 0, "", 0 }, }; @@ -606,29 +541,16 @@ /* Embolden these glyphs slightly. */ -#define EMBOLDEN_RULES_SIZE 5 +#define EMBOLDEN_RULES_SIZE 2 static const SPH_TweakRule EMBOLDEN_Rules [EMBOLDEN_RULES_SIZE] = { - { "Courier New", 12, "Italic", 'z' }, - { "Courier New", 11, "Italic", 'z' }, - { "Courier New", 10, "Italic", 'z' }, { "Courier New", 0, "Regular", 0 }, { "Courier New", 0, "Italic", 0 }, }; - /* Do an extra RDTG instruction in DELTAP if matched. */ -#define DELTAP_RDTG_RULES_SIZE 1 - - static const SPH_TweakRule DELTAP_RDTG_Rules - [DELTAP_RDTG_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7 */ /* similar to Windows XP. */ #define TIMES_NEW_ROMAN_HACK_RULES_SIZE 12 @@ -999,12 +921,9 @@ } TWEAK_RULES( ALLOW_X_DMOVE ); - TWEAK_RULES( ALLOW_X_DMOVEX ); - TWEAK_RULES( ALLOW_X_MOVE_ZP2 ); TWEAK_RULES( ALWAYS_DO_DELTAP ); TWEAK_RULES( ALWAYS_SKIP_DELTAP ); TWEAK_RULES( DEEMBOLDEN ); - TWEAK_RULES( DELTAP_SKIP_EXAGGERATED_VALUES ); TWEAK_RULES( DO_SHPIX ); TWEAK_RULES( EMBOLDEN ); TWEAK_RULES( MIAP_HACK ); @@ -1013,13 +932,13 @@ TWEAK_RULES( NO_CALL_AFTER_IUP ); TWEAK_RULES( NO_DELTAP_AFTER_IUP ); TWEAK_RULES( RASTERIZER_35 ); - TWEAK_RULES( SKIP_INLINE_DELTAS ); TWEAK_RULES( SKIP_IUP ); - TWEAK_RULES( MIRP_CVT_ZERO ); TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES ); TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES ); + TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES_DELTAP ); + TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES ); TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES ); diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h index 5e5d8e69e..8a54fc7cc 100644 --- a/src/truetype/ttsubpix.h +++ b/src/truetype/ttsubpix.h @@ -34,14 +34,15 @@ FT_BEGIN_HEADER /* ID flags to identify special functions at FDEF and runtime. */ /* */ /* */ -#define SPH_FDEF_INLINE_DELTA_1 0x0000001 -#define SPH_FDEF_INLINE_DELTA_2 0x0000002 -#define SPH_FDEF_DIAGONAL_STROKE 0x0000004 -#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008 -#define SPH_FDEF_TTFAUTOHINT_1 0x0000010 -#define SPH_FDEF_SPACING_1 0x0000020 -#define SPH_FDEF_SPACING_2 0x0000040 -#define SPH_FDEF_TYPEMAN_STROKES 0x0000080 +#define SPH_FDEF_INLINE_DELTA_1 0x0000001 +#define SPH_FDEF_INLINE_DELTA_2 0x0000002 +#define SPH_FDEF_DIAGONAL_STROKE 0x0000004 +#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008 +#define SPH_FDEF_TTFAUTOHINT_1 0x0000010 +#define SPH_FDEF_SPACING_1 0x0000020 +#define SPH_FDEF_SPACING_2 0x0000040 +#define SPH_FDEF_TYPEMAN_STROKES 0x0000080 +#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100 /*************************************************************************/ @@ -50,29 +51,25 @@ FT_BEGIN_HEADER /* */ /* */ #define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001 -#define SPH_TWEAK_ALLOW_X_DMOVEX 0x0000002 -#define SPH_TWEAK_ALLOW_X_MOVE_ZP2 0x0000004 -#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000008 -#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000010 -#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000020 -#define SPH_TWEAK_DEEMBOLDEN 0x0000040 -#define SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES 0x0000080 -#define SPH_TWEAK_DO_SHPIX 0x0000100 -#define SPH_TWEAK_EMBOLDEN 0x0000200 -#define SPH_TWEAK_MIAP_HACK 0x0000400 -#define SPH_TWEAK_NORMAL_ROUND 0x0000800 -#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0001000 -#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0002000 -#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0004000 -#define SPH_TWEAK_PIXEL_HINTING 0x0008000 -#define SPH_TWEAK_RASTERIZER_35 0x0010000 -#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0020000 -#define SPH_TWEAK_SKIP_INLINE_DELTAS 0x0040000 -#define SPH_TWEAK_SKIP_IUP 0x0080000 -#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0100000 -#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0200000 -#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0400000 -#define SPH_TWEAK_MIRP_CVT_ZERO 0x0800000 +#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002 +#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004 +#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008 +#define SPH_TWEAK_DEEMBOLDEN 0x0000010 +#define SPH_TWEAK_DO_SHPIX 0x0000020 +#define SPH_TWEAK_EMBOLDEN 0x0000040 +#define SPH_TWEAK_MIAP_HACK 0x0000080 +#define SPH_TWEAK_NORMAL_ROUND 0x0000100 +#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200 +#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400 +#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800 +#define SPH_TWEAK_PIXEL_HINTING 0x0001000 +#define SPH_TWEAK_RASTERIZER_35 0x0002000 +#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000 +#define SPH_TWEAK_SKIP_IUP 0x0008000 +#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000 +#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000 +#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000 +#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000 FT_LOCAL( FT_Bool )