24 #include FT_INTERNAL_DEBUG_H 25 #include FT_INTERNAL_CALC_H 26 #include FT_TRIGONOMETRY_H 34 #ifdef TT_USE_BYTECODE_INTERPRETER 44 #define FT_COMPONENT trace_ttinterp 52 #define MAX_RUNNABLE_OPCODES 1000000L 92 #ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER 101 #define FT_UNUSED_EXEC FT_UNUSED( exc ) 107 #define FT_UNUSED_EXEC int __dummy = __dummy 123 #define INS_ARG EXEC_OP_ FT_Long* args 131 #define FT_UNUSED_ARG FT_UNUSED_EXEC; FT_UNUSED( args ) 142 #define SKIP_Code() \ 145 #define GET_ShortIns() \ 146 GetShortIns( EXEC_ARG ) 148 #define NORMalize( x, y, v ) \ 149 Normalize( EXEC_ARG_ x, y, v ) 151 #define SET_SuperRound( scale, flags ) \ 152 SetSuperRound( EXEC_ARG_ scale, flags ) 154 #define ROUND_None( d, c ) \ 155 Round_None( EXEC_ARG_ d, c ) 157 #define INS_Goto_CodeRange( range, ip ) \ 158 Ins_Goto_CodeRange( EXEC_ARG_ range, ip ) 160 #define CUR_Func_move( z, p, d ) \ 161 CUR.func_move( EXEC_ARG_ z, p, d ) 163 #define CUR_Func_move_orig( z, p, d ) \ 164 CUR.func_move_orig( EXEC_ARG_ z, p, d ) 166 #define CUR_Func_round( d, c ) \ 167 CUR.func_round( EXEC_ARG_ d, c ) 169 #define CUR_Func_read_cvt( index ) \ 170 CUR.func_read_cvt( EXEC_ARG_ index ) 172 #define CUR_Func_write_cvt( index, val ) \ 173 CUR.func_write_cvt( EXEC_ARG_ index, val ) 175 #define CUR_Func_move_cvt( index, val ) \ 176 CUR.func_move_cvt( EXEC_ARG_ index, val ) 178 #define CURRENT_Ratio() \ 179 Current_Ratio( EXEC_ARG ) 181 #define CURRENT_Ppem() \ 182 Current_Ppem( EXEC_ARG ) 187 #define INS_SxVTL( a, b, c, d ) \ 188 Ins_SxVTL( EXEC_ARG_ a, b, c, d ) 190 #define COMPUTE_Funcs() \ 191 Compute_Funcs( EXEC_ARG ) 193 #define COMPUTE_Round( a ) \ 194 Compute_Round( EXEC_ARG_ a ) 196 #define COMPUTE_Point_Displacement( a, b, c, d ) \ 197 Compute_Point_Displacement( EXEC_ARG_ a, b, c, d ) 199 #define MOVE_Zp2_Point( a, b, c, t ) \ 200 Move_Zp2_Point( EXEC_ARG_ a, b, c, t ) 203 #define CUR_Func_project( v1, v2 ) \ 204 CUR.func_project( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y ) 206 #define CUR_Func_dualproj( v1, v2 ) \ 207 CUR.func_dualproj( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y ) 209 #define CUR_fast_project( v ) \ 210 CUR.func_project( EXEC_ARG_ (v)->x, (v)->y ) 212 #define CUR_fast_dualproj( v ) \ 213 CUR.func_dualproj( EXEC_ARG_ (v)->x, (v)->y ) 220 typedef void (*TInstruction_Function)( INS_ARG );
227 #define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) ) 228 #define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) ) 234 #define TT_DivFix14( a, b ) \ 235 FT_DivFix( a, (b) << 2 ) 244 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 245 #define GUESS_VECTOR( V ) \ 246 if ( CUR.face->unpatented_hinting ) \ 248 CUR.GS.V.x = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0x4000 : 0 ); \ 249 CUR.GS.V.y = (FT_F2Dot14)( CUR.GS.both_x_axis ? 0 : 0x4000 ); \ 252 #define GUESS_VECTOR( V ) 462 FT_TRACE1((
"Init_Context: new object at 0x%08p\n", exec ));
487 FT_ERROR((
"Init_Context: not enough memory for %p\n", exec ));
488 TT_Done_Context( exec );
526 void** pbuff = (
void**)_pbuff;
529 if ( *size < new_max )
531 if (
FT_REALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
579 exec->
numFDefs = size->num_function_defs;
580 exec->
maxFDefs = size->max_function_defs;
581 exec->
numIDefs = size->num_instruction_defs;
582 exec->
maxIDefs = size->max_instruction_defs;
583 exec->
FDefs = size->function_defs;
584 exec->
IDefs = size->instruction_defs;
588 exec->
maxFunc = size->max_func;
589 exec->
maxIns = size->max_ins;
597 exec->
cvtSize = size->cvt_size;
598 exec->
cvt = size->cvt;
615 error = Update_Max( exec->
memory,
625 error = Update_Max( exec->
memory,
677 size->num_function_defs = exec->
numFDefs;
678 size->num_instruction_defs = exec->
numIDefs;
680 size->max_func = exec->
maxFunc;
681 size->max_ins = exec->
maxIns;
739 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 740 exec->
GS.both_x_axis =
TRUE;
778 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 783 TRUE, 68, 0, 0, 9, 3,
797 memory = driver->root.root.
memory;
798 exec = driver->context;
800 if ( !driver->context )
810 error = Init_Context( exec, memory );
815 driver->context = exec;
818 return driver->context;
844 #define PACK( x, y ) ( ( x << 4 ) | y ) 848 const FT_Byte Pop_Push_Count[256] =
1127 #ifdef FT_DEBUG_LEVEL_TRACE 1130 const char*
const opcode_name[256] =
1409 const FT_Char opcode_length[256] =
1411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1416 -1,-2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1424 2, 3, 4, 5, 6, 7, 8, 9, 3, 5, 7, 9, 11,13,15,17,
1426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1451 ah = (
FT_UInt32)( ( a >> 16 ) & 0xFFFFU );
1457 mid = ( mid << 16 ) + ( 1 << 13 );
1462 mid = ( lo >> 14 ) | ( hi << 18 );
1480 m = ( a >> 16 ) * b;
1483 hi = ( m >> 16 ) + ( (
FT_Int32)l >> 31 ) + ( lo < l );
1488 hi += s + ( l < lo );
1511 l = (
FT_UInt32)( ( ax & 0xFFFFU ) * bx );
1512 m = ( ax >> 16 ) * bx;
1515 hi1 = ( m >> 16 ) + ( (
FT_Int32)l >> 31 ) + ( lo1 < l );
1519 m = ( ay >> 16 ) * by;
1522 hi2 = ( m >> 16 ) + ( (
FT_Int32)l >> 31 ) + ( lo2 < l );
1526 hi = hi1 + hi2 + ( lo < lo1 );
1531 hi += s + ( l < lo );
1556 if ( !CUR.tt_metrics.ratio )
1558 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 1559 if ( CUR.face->unpatented_hinting )
1561 if ( CUR.GS.both_x_axis )
1562 CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;
1564 CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;
1569 if ( CUR.GS.projVector.y == 0 )
1570 CUR.tt_metrics.ratio = CUR.tt_metrics.x_ratio;
1572 else if ( CUR.GS.projVector.x == 0 )
1573 CUR.tt_metrics.ratio = CUR.tt_metrics.y_ratio;
1580 x = TT_MulFix14( CUR.tt_metrics.x_ratio,
1581 CUR.GS.projVector.x );
1582 y = TT_MulFix14( CUR.tt_metrics.y_ratio,
1583 CUR.GS.projVector.y );
1584 CUR.tt_metrics.ratio =
FT_Hypot( x, y );
1588 return CUR.tt_metrics.ratio;
1595 return FT_MulFix( CUR.tt_metrics.ppem, CURRENT_Ratio() );
1609 return CUR.cvt[
idx];
1616 return FT_MulFix( CUR.cvt[idx], CURRENT_Ratio() );
1672 return (
FT_Short)( ( CUR.code[CUR.IP - 2] << 8 ) +
1673 CUR.code[CUR.IP - 1] );
1700 if ( aRange < 1 || aRange > 3 )
1702 CUR.error =
FT_THROW( Bad_Argument );
1706 range = &CUR.codeRangeTable[aRange - 1];
1710 CUR.error =
FT_THROW( Invalid_CodeRange );
1718 if ( aIP > range->
size )
1720 CUR.error =
FT_THROW( Code_Overflow );
1724 CUR.code = range->
base;
1725 CUR.codeSize = range->
size;
1727 CUR.curRange = aRange;
1758 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 1759 FT_ASSERT( !CUR.face->unpatented_hinting );
1762 v = CUR.GS.freeVector.x;
1766 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 1767 if ( !CUR.ignore_x_mode ||
1768 ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) )
1770 zone->cur[point].x +=
FT_MulDiv( distance, v, CUR.F_dot_P );
1775 v = CUR.GS.freeVector.y;
1779 zone->cur[point].y +=
FT_MulDiv( distance, v, CUR.F_dot_P );
1811 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 1812 FT_ASSERT( !CUR.face->unpatented_hinting );
1815 v = CUR.GS.freeVector.x;
1818 zone->org[point].x +=
FT_MulDiv( distance, v, CUR.F_dot_P );
1820 v = CUR.GS.freeVector.y;
1823 zone->org[point].y +=
FT_MulDiv( distance, v, CUR.F_dot_P );
1844 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 1845 if ( !CUR.ignore_x_mode ||
1846 ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) )
1928 if ( distance >= 0 )
1930 val = distance + compensation;
1931 if ( distance && val < 0 )
1936 val = distance - compensation;
1969 if ( distance >= 0 )
1971 val = distance + compensation + 32;
1972 if ( distance && val > 0 )
2013 if ( distance >= 0 )
2016 if ( distance && val < 0 )
2021 val = -(
FT_PIX_FLOOR( compensation - distance ) + 32 );
2055 if ( distance >= 0 )
2057 val = distance + compensation;
2058 if ( distance && val > 0 )
2065 val = -( ( compensation -
distance ) & -64 );
2099 if ( distance >= 0 )
2101 val = distance + compensation + 63;
2102 if ( distance && val > 0 )
2143 if ( distance >= 0 )
2145 val = distance + compensation + 16;
2146 if ( distance && val > 0 )
2191 if ( distance >= 0 )
2193 val = ( distance - CUR.phase + CUR.threshold + compensation ) &
2195 if ( distance && val < 0 )
2201 val = -( ( CUR.threshold - CUR.phase - distance + compensation ) &
2239 if ( distance >= 0 )
2241 val = ( ( distance - CUR.phase + CUR.threshold + compensation ) /
2242 CUR.period ) * CUR.period;
2243 if ( distance && val < 0 )
2249 val = -( ( ( CUR.threshold - CUR.phase - distance + compensation ) /
2250 CUR.period ) * CUR.period );
2274 switch ( round_mode )
2328 switch ( (
FT_Int)( selector & 0xC0 ) )
2331 CUR.period = GridPeriod / 2;
2335 CUR.period = GridPeriod;
2339 CUR.period = GridPeriod * 2;
2345 CUR.period = GridPeriod;
2349 switch ( (
FT_Int)( selector & 0x30 ) )
2356 CUR.phase = CUR.period / 4;
2360 CUR.phase = CUR.period / 2;
2364 CUR.phase = CUR.period * 3 / 4;
2368 if ( ( selector & 0x0F ) == 0 )
2369 CUR.threshold = CUR.period - 1;
2371 CUR.threshold = ( (
FT_Int)( selector & 0x0F ) - 4 ) * CUR.period / 8;
2375 CUR.threshold /= 256;
2399 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 2400 FT_ASSERT( !CUR.face->unpatented_hinting );
2404 CUR.GS.projVector.x,
2405 CUR.GS.projVector.y );
2430 CUR.GS.dualVector.x,
2431 CUR.GS.dualVector.y );
2501 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 2502 if ( CUR.face->unpatented_hinting )
2508 CUR.GS.both_x_axis = (
FT_Bool)( CUR.GS.projVector.x == 0x4000 &&
2509 CUR.GS.freeVector.x == 0x4000 );
2514 CUR.GS.projVector.x = 0;
2515 CUR.GS.projVector.y = 0;
2516 CUR.GS.freeVector.x = 0;
2517 CUR.GS.freeVector.y = 0;
2519 if ( CUR.GS.both_x_axis )
2521 CUR.func_project = Project_x;
2522 CUR.func_move = Direct_Move_X;
2523 CUR.func_move_orig = Direct_Move_Orig_X;
2527 CUR.func_project = Project_y;
2528 CUR.func_move = Direct_Move_Y;
2529 CUR.func_move_orig = Direct_Move_Orig_Y;
2532 if ( CUR.GS.dualVector.x == 0x4000 )
2533 CUR.func_dualproj = Project_x;
2534 else if ( CUR.GS.dualVector.y == 0x4000 )
2535 CUR.func_dualproj = Project_y;
2537 CUR.func_dualproj = Dual_Project;
2540 CUR.tt_metrics.ratio = 0;
2546 if ( CUR.GS.freeVector.x == 0x4000 )
2547 CUR.F_dot_P = CUR.GS.projVector.x;
2548 else if ( CUR.GS.freeVector.y == 0x4000 )
2549 CUR.F_dot_P = CUR.GS.projVector.y;
2551 CUR.F_dot_P = ( (
FT_Long)CUR.GS.projVector.x * CUR.GS.freeVector.x +
2552 (
FT_Long)CUR.GS.projVector.y * CUR.GS.freeVector.y ) >>
2555 if ( CUR.GS.projVector.x == 0x4000 )
2557 else if ( CUR.GS.projVector.y == 0x4000 )
2562 if ( CUR.GS.dualVector.x == 0x4000 )
2564 else if ( CUR.GS.dualVector.y == 0x4000 )
2572 if ( CUR.F_dot_P == 0x4000L )
2574 if ( CUR.GS.freeVector.x == 0x4000 )
2579 else if ( CUR.GS.freeVector.y == 0x4000 )
2589 if (
FT_ABS( CUR.F_dot_P ) < 0x400L )
2590 CUR.F_dot_P = 0x4000L;
2593 CUR.tt_metrics.ratio = 0;
2629 if (
FT_ABS( Vx ) < 0x4000L &&
FT_ABS( Vy ) < 0x4000L )
2631 if ( Vx == 0 && Vy == 0 )
2669 if ( BOUNDS( aIdx1, CUR.zp2.n_points ) ||
2670 BOUNDS( aIdx2, CUR.zp1.n_points ) )
2672 if ( CUR.pedantic_hinting )
2673 CUR.error =
FT_THROW( Invalid_Reference );
2677 p1 = CUR.zp1.cur + aIdx2;
2678 p2 = CUR.zp2.cur + aIdx1;
2688 if ( A == 0 && B == 0 )
2694 if ( ( aOpc & 1 ) != 0 )
2701 NORMalize( A, B, Vec );
2718 A = (FT_Short)( CUR.opcode & 1 ) << 14; \ 2719 B = A ^ (FT_Short)0x4000; \ 2721 CUR.GS.freeVector.x = A; \ 2722 CUR.GS.projVector.x = A; \ 2723 CUR.GS.dualVector.x = A; \ 2725 CUR.GS.freeVector.y = B; \ 2726 CUR.GS.projVector.y = B; \ 2727 CUR.GS.dualVector.y = B; \ 2738 A = (FT_Short)( CUR.opcode & 1 ) << 14; \ 2739 B = A ^ (FT_Short)0x4000; \ 2741 CUR.GS.projVector.x = A; \ 2742 CUR.GS.dualVector.x = A; \ 2744 CUR.GS.projVector.y = B; \ 2745 CUR.GS.dualVector.y = B; \ 2747 GUESS_VECTOR( freeVector ); \ 2758 A = (FT_Short)( CUR.opcode & 1 ) << 14; \ 2759 B = A ^ (FT_Short)0x4000; \ 2761 CUR.GS.freeVector.x = A; \ 2762 CUR.GS.freeVector.y = B; \ 2764 GUESS_VECTOR( projVector ); \ 2771 if ( INS_SxVTL( (FT_UShort)args[1], \ 2772 (FT_UShort)args[0], \ 2774 &CUR.GS.projVector ) == SUCCESS ) \ 2776 CUR.GS.dualVector = CUR.GS.projVector; \ 2777 GUESS_VECTOR( freeVector ); \ 2783 if ( INS_SxVTL( (FT_UShort)args[1], \ 2784 (FT_UShort)args[0], \ 2786 &CUR.GS.freeVector ) == SUCCESS ) \ 2788 GUESS_VECTOR( projVector ); \ 2794 GUESS_VECTOR( projVector ); \ 2795 CUR.GS.freeVector = CUR.GS.projVector; \ 2806 S = (FT_Short)args[1]; \ 2808 S = (FT_Short)args[0]; \ 2811 NORMalize( X, Y, &CUR.GS.projVector ); \ 2813 CUR.GS.dualVector = CUR.GS.projVector; \ 2814 GUESS_VECTOR( freeVector ); \ 2826 S = (FT_Short)args[1]; \ 2828 S = (FT_Short)args[0]; \ 2831 NORMalize( X, Y, &CUR.GS.freeVector ); \ 2832 GUESS_VECTOR( projVector ); \ 2837 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 2839 if ( CUR.face->unpatented_hinting ) \ 2841 args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \ 2842 args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \ 2846 args[0] = CUR.GS.projVector.x; \ 2847 args[1] = CUR.GS.projVector.y; \ 2851 args[0] = CUR.GS.projVector.x; \ 2852 args[1] = CUR.GS.projVector.y; 2856 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 2858 if ( CUR.face->unpatented_hinting ) \ 2860 args[0] = CUR.GS.both_x_axis ? 0x4000 : 0; \ 2861 args[1] = CUR.GS.both_x_axis ? 0 : 0x4000; \ 2865 args[0] = CUR.GS.freeVector.x; \ 2866 args[1] = CUR.GS.freeVector.y; \ 2870 args[0] = CUR.GS.freeVector.x; \ 2871 args[1] = CUR.GS.freeVector.y; 2876 CUR.GS.rp0 = (FT_UShort)args[0]; 2880 CUR.GS.rp1 = (FT_UShort)args[0]; 2884 CUR.GS.rp2 = (FT_UShort)args[0]; 2888 CUR.GS.round_state = TT_Round_To_Half_Grid; \ 2889 CUR.func_round = (TT_Round_Func)Round_To_Half_Grid; 2893 CUR.GS.round_state = TT_Round_To_Grid; \ 2894 CUR.func_round = (TT_Round_Func)Round_To_Grid; 2898 CUR.GS.round_state = TT_Round_To_Double_Grid; \ 2899 CUR.func_round = (TT_Round_Func)Round_To_Double_Grid; 2903 CUR.GS.round_state = TT_Round_Up_To_Grid; \ 2904 CUR.func_round = (TT_Round_Func)Round_Up_To_Grid; 2908 CUR.GS.round_state = TT_Round_Down_To_Grid; \ 2909 CUR.func_round = (TT_Round_Func)Round_Down_To_Grid; 2913 CUR.GS.round_state = TT_Round_Off; \ 2914 CUR.func_round = (TT_Round_Func)Round_None; 2918 SET_SuperRound( 0x4000, args[0] ); \ 2919 CUR.GS.round_state = TT_Round_Super; \ 2920 CUR.func_round = (TT_Round_Func)Round_Super; 2923 #define DO_S45ROUND \ 2924 SET_SuperRound( 0x2D41, args[0] ); \ 2925 CUR.GS.round_state = TT_Round_Super_45; \ 2926 CUR.func_round = (TT_Round_Func)Round_Super_45; 2930 if ( args[0] < 0 ) \ 2931 CUR.error = FT_THROW( Bad_Argument ); \ 2933 CUR.GS.loop = args[0]; 2937 CUR.GS.minimum_distance = args[0]; 2941 CUR.GS.control_value_cutin = (FT_F26Dot6)args[0]; 2945 CUR.GS.single_width_cutin = (FT_F26Dot6)args[0]; 2949 CUR.GS.single_width_value = FT_MulFix( args[0], \ 2950 CUR.tt_metrics.scale ); 2954 CUR.GS.auto_flip = TRUE; 2957 #define DO_FLIPOFF \ 2958 CUR.GS.auto_flip = FALSE; 2962 CUR.GS.delta_base = (FT_Short)args[0]; 2966 CUR.GS.delta_shift = (FT_Short)args[0]; 2973 args[0] = CURRENT_Ppem(); 2981 args[0] = CUR.metrics.pointSize; 2986 args[0] = CURRENT_Ppem(); 3005 args[0] = args[1]; \ 3021 if ( L <= 0 || L > CUR.args ) \ 3023 if ( CUR.pedantic_hinting ) \ 3024 CUR.error = FT_THROW( Invalid_Reference ); \ 3028 args[0] = CUR.stack[CUR.args - L]; \ 3033 if ( args[1] != 0 ) \ 3035 if ( args[0] == 0 && CUR.args == 0 ) \ 3036 CUR.error = FT_THROW( Bad_Argument ); \ 3037 CUR.IP += args[0]; \ 3038 if ( CUR.IP < 0 || \ 3039 ( CUR.callTop > 0 && \ 3040 CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ 3041 CUR.error = FT_THROW( Bad_Argument ); \ 3042 CUR.step_ins = FALSE; \ 3047 if ( args[0] == 0 && CUR.args == 0 ) \ 3048 CUR.error = FT_THROW( Bad_Argument ); \ 3049 CUR.IP += args[0]; \ 3050 if ( CUR.IP < 0 || \ 3051 ( CUR.callTop > 0 && \ 3052 CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ 3053 CUR.error = FT_THROW( Bad_Argument ); \ 3054 CUR.step_ins = FALSE; 3058 if ( args[1] == 0 ) \ 3060 if ( args[0] == 0 && CUR.args == 0 ) \ 3061 CUR.error = FT_THROW( Bad_Argument ); \ 3062 CUR.IP += args[0]; \ 3063 if ( CUR.IP < 0 || \ 3064 ( CUR.callTop > 0 && \ 3065 CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ 3066 CUR.error = FT_THROW( Bad_Argument ); \ 3067 CUR.step_ins = FALSE; \ 3072 args[0] = ( args[0] < args[1] ); 3076 args[0] = ( args[0] <= args[1] ); 3080 args[0] = ( args[0] > args[1] ); 3084 args[0] = ( args[0] >= args[1] ); 3088 args[0] = ( args[0] == args[1] ); 3092 args[0] = ( args[0] != args[1] ); 3096 args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 64 ); 3100 args[0] = ( ( CUR_Func_round( args[0], 0 ) & 127 ) == 0 ); 3104 args[0] = ( args[0] && args[1] ); 3108 args[0] = ( args[0] || args[1] ); 3124 if ( args[1] == 0 ) \ 3125 CUR.error = FT_THROW( Divide_By_Zero ); \ 3127 args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] ); 3131 args[0] = FT_MulDiv( args[0], args[1], 64L ); 3135 args[0] = FT_ABS( args[0] ); 3143 args[0] = FT_PIX_FLOOR( args[0] ); 3146 #define DO_CEILING \ 3147 args[0] = FT_PIX_CEIL( args[0] ); 3149 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 3153 FT_ULong I = (FT_ULong)args[0]; \ 3156 if ( BOUNDSL( I, CUR.storeSize ) ) \ 3158 if ( CUR.pedantic_hinting ) \ 3159 ARRAY_BOUND_ERROR; \ 3168 if ( CUR.ignore_x_mode && \ 3170 ( CUR.face->sph_found_func_flags & \ 3171 ( SPH_FDEF_SPACING_1 | \ 3172 SPH_FDEF_SPACING_2 ) ) ) || \ 3174 ( CUR.sph_in_func_flags & \ 3175 SPH_FDEF_TYPEMAN_STROKES ) ) || \ 3177 ( CUR.face->sph_found_func_flags & \ 3178 SPH_FDEF_VACUFORM_ROUND_1 ) && \ 3179 CUR.iup_called ) ) ) \ 3182 args[0] = CUR.storage[I]; \ 3190 FT_ULong I = (FT_ULong)args[0]; \ 3193 if ( BOUNDSL( I, CUR.storeSize ) ) \ 3195 if ( CUR.pedantic_hinting ) \ 3197 ARRAY_BOUND_ERROR; \ 3203 args[0] = CUR.storage[I]; \ 3211 FT_ULong I = (FT_ULong)args[0]; \ 3214 if ( BOUNDSL( I, CUR.storeSize ) ) \ 3216 if ( CUR.pedantic_hinting ) \ 3218 ARRAY_BOUND_ERROR; \ 3222 CUR.storage[I] = args[1]; \ 3228 FT_ULong I = (FT_ULong)args[0]; \ 3231 if ( BOUNDSL( I, CUR.cvtSize ) ) \ 3233 if ( CUR.pedantic_hinting ) \ 3235 ARRAY_BOUND_ERROR; \ 3241 args[0] = CUR_Func_read_cvt( I ); \ 3247 FT_ULong I = (FT_ULong)args[0]; \ 3250 if ( BOUNDSL( I, CUR.cvtSize ) ) \ 3252 if ( CUR.pedantic_hinting ) \ 3254 ARRAY_BOUND_ERROR; \ 3258 CUR_Func_write_cvt( I, args[1] ); \ 3264 FT_ULong I = (FT_ULong)args[0]; \ 3267 if ( BOUNDSL( I, CUR.cvtSize ) ) \ 3269 if ( CUR.pedantic_hinting ) \ 3271 ARRAY_BOUND_ERROR; \ 3275 CUR.cvt[I] = FT_MulFix( args[1], CUR.tt_metrics.scale ); \ 3280 CUR.error = FT_THROW( Debug_OpCode ); 3284 args[0] = CUR_Func_round( \ 3286 CUR.tt_metrics.compensations[CUR.opcode - 0x68] ); 3290 args[0] = ROUND_None( args[0], \ 3291 CUR.tt_metrics.compensations[CUR.opcode - 0x6C] ); 3295 if ( args[1] > args[0] ) \ 3300 if ( args[1] < args[0] ) \ 3304 #ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH 3307 #undef ARRAY_BOUND_ERROR 3308 #define ARRAY_BOUND_ERROR \ 3310 CUR.error = FT_THROW( Invalid_Reference ); \ 3322 Ins_SVTCA( INS_ARG )
3335 Ins_SPVTCA( INS_ARG )
3348 Ins_SFVTCA( INS_ARG )
3361 Ins_SPVTL( INS_ARG )
3374 Ins_SFVTL( INS_ARG )
3387 Ins_SFVTPV( INS_ARG )
3400 Ins_SPVFS( INS_ARG )
3413 Ins_SFVFS( INS_ARG )
3566 Ins_SROUND( INS_ARG )
3579 Ins_S45ROUND( INS_ARG )
3592 Ins_SLOOP( INS_ARG )
3618 Ins_SCVTCI( INS_ARG )
3631 Ins_SSWCI( INS_ARG )
3657 Ins_FLIPON( INS_ARG )
3670 Ins_FLIPOFF( INS_ARG )
3683 Ins_SANGW( INS_ARG )
3722 Ins_MPPEM( INS_ARG )
3774 Ins_CLEAR( INS_ARG )
3800 Ins_DEPTH( INS_ARG )
3813 Ins_CINDEX( INS_ARG )
4099 Ins_FLOOR( INS_ARG )
4112 Ins_CEILING( INS_ARG )
4151 Ins_WCVTP( INS_ARG )
4164 Ins_WCVTF( INS_ARG )
4205 Ins_DEBUG( INS_ARG )
4218 Ins_ROUND( INS_ARG )
4231 Ins_NROUND( INS_ARG )
4280 Ins_MINDEX( INS_ARG )
4287 if ( L <= 0 || L > CUR.args )
4289 if ( CUR.pedantic_hinting )
4290 CUR.error =
FT_THROW( Invalid_Reference );
4294 K = CUR.stack[CUR.args - L];
4297 &CUR.stack[CUR.args - L + 1],
4300 CUR.stack[CUR.args - 1] = K;
4341 CUR.IP += CUR.length;
4343 if ( CUR.IP < CUR.codeSize )
4345 CUR.opcode = CUR.code[CUR.IP];
4347 CUR.length = opcode_length[CUR.opcode];
4348 if ( CUR.length < 0 )
4350 if ( CUR.IP + 1 >= CUR.codeSize )
4352 CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1];
4355 if ( CUR.IP + CUR.length <= CUR.codeSize )
4360 CUR.error =
FT_THROW( Code_Overflow );
4389 switch ( CUR.opcode )
4404 }
while ( Out == 0 );
4429 switch ( CUR.opcode )
4439 }
while ( nIfs != 0 );
4465 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4467 FT_Byte opcode_pattern[7][12] = {
4547 FT_UShort opcode_pointer[7] = { 0, 0, 0, 0, 0, 0, 0 };
4548 FT_UShort opcode_size[7] = { 12, 8, 8, 6, 7, 4, 5 };
4557 limit = rec + CUR.numFDefs;
4560 for ( ; rec <
limit; rec++ )
4562 if ( rec->
opc == n )
4569 if ( CUR.numFDefs >= CUR.maxFDefs )
4571 CUR.error =
FT_THROW( Too_Many_Function_Defs );
4581 CUR.error =
FT_THROW( Too_Many_Function_Defs );
4585 rec->
range = CUR.curRange;
4587 rec->
start = CUR.IP + 1;
4592 if ( n > CUR.maxFunc )
4595 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4598 if ( n >= 64 && n <= 66 )
4605 while ( SKIP_Code() ==
SUCCESS )
4607 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4609 for ( i = 0; i < opcode_patterns; i++ )
4611 if ( opcode_pointer[i] < opcode_size[i] &&
4612 CUR.opcode == opcode_pattern[i][opcode_pointer[i]] )
4614 opcode_pointer[
i] += 1;
4616 if ( opcode_pointer[i] == opcode_size[i] )
4618 FT_TRACE7((
"sph: Function %d, opcode ptrn: %d, %s %s\n",
4620 CUR.face->root.family_name,
4621 CUR.face->root.style_name ));
4627 CUR.face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_1;
4632 CUR.face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_2;
4641 CUR.face->sph_found_func_flags |= SPH_FDEF_DIAGONAL_STROKE;
4650 CUR.face->sph_found_func_flags |= SPH_FDEF_VACUFORM_ROUND_1;
4657 CUR.face->sph_found_func_flags |= SPH_FDEF_TTFAUTOHINT_1;
4670 CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_1;
4684 CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_2;
4688 opcode_pointer[
i] = 0;
4693 opcode_pointer[
i] = 0;
4697 CUR.face->sph_compatibility_mode =
4698 ( ( CUR.face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_1 ) |
4699 ( CUR.face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_2 ) );
4703 switch ( CUR.opcode )
4707 CUR.error =
FT_THROW( Nested_DEFS );
4732 if ( CUR.callTop <= 0 )
4734 CUR.error =
FT_THROW( ENDF_In_Exec_Stream );
4740 pRec = &CUR.callStack[CUR.callTop];
4744 CUR.step_ins =
FALSE;
4783 if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
4795 def = CUR.FDefs +
F;
4796 if ( CUR.maxFunc + 1 != CUR.numFDefs || def->
opc != F )
4803 limit = def + CUR.numFDefs;
4805 while ( def < limit && def->opc != F )
4816 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4821 if ( CUR.callTop >= CUR.callSize )
4823 CUR.error =
FT_THROW( Stack_Overflow );
4827 pCrec = CUR.callStack + CUR.callTop;
4837 INS_Goto_CodeRange( def->
range,
4840 CUR.step_ins =
FALSE;
4842 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4849 CUR.error =
FT_THROW( Invalid_Reference );
4860 Ins_LOOPCALL( INS_ARG )
4869 if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
4881 def = CUR.FDefs +
F;
4882 if ( CUR.maxFunc + 1 != CUR.numFDefs || def->
opc != F )
4889 limit = def + CUR.numFDefs;
4891 while ( def < limit && def->opc != F )
4902 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4907 if ( CUR.callTop >= CUR.callSize )
4909 CUR.error =
FT_THROW( Stack_Overflow );
4915 pCrec = CUR.callStack + CUR.callTop;
4925 INS_Goto_CodeRange( def->
range, def->
start );
4927 CUR.step_ins =
FALSE;
4930 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 4937 CUR.error =
FT_THROW( Invalid_Reference );
4957 limit = def + CUR.numIDefs;
4959 for ( ; def <
limit; def++ )
4966 if ( CUR.numIDefs >= CUR.maxIDefs )
4968 CUR.error =
FT_THROW( Too_Many_Instruction_Defs );
4975 if ( 0 > args[0] || args[0] > 0x00FF )
4977 CUR.error =
FT_THROW( Too_Many_Instruction_Defs );
4982 def->
start = CUR.IP + 1;
4983 def->
range = CUR.curRange;
4986 if ( (
FT_ULong)args[0] > CUR.maxIns )
4987 CUR.maxIns = (
FT_Byte)args[0];
4992 while ( SKIP_Code() ==
SUCCESS )
4994 switch ( CUR.opcode )
4998 CUR.error =
FT_THROW( Nested_DEFS );
5023 Ins_NPUSHB( INS_ARG )
5030 if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
5032 CUR.error =
FT_THROW( Stack_Overflow );
5036 for ( K = 1; K <= L; K++ )
5037 args[K - 1] = CUR.code[CUR.IP + K + 1];
5050 Ins_NPUSHW( INS_ARG )
5057 if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
5059 CUR.error =
FT_THROW( Stack_Overflow );
5065 for ( K = 0; K < L; K++ )
5066 args[K] = GET_ShortIns();
5068 CUR.step_ins =
FALSE;
5080 Ins_PUSHB( INS_ARG )
5085 L = (
FT_UShort)( CUR.opcode - 0xB0 + 1 );
5087 if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
5089 CUR.error =
FT_THROW( Stack_Overflow );
5093 for ( K = 1; K <= L; K++ )
5094 args[K - 1] = CUR.code[CUR.IP + K];
5105 Ins_PUSHW( INS_ARG )
5110 L = (
FT_UShort)( CUR.opcode - 0xB8 + 1 );
5112 if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
5114 CUR.error =
FT_THROW( Stack_Overflow );
5120 for ( K = 0; K < L; K++ )
5121 args[K] = GET_ShortIns();
5123 CUR.step_ins =
FALSE;
5154 if ( BOUNDSL( L, CUR.zp2.n_points ) )
5156 if ( CUR.pedantic_hinting )
5157 CUR.error =
FT_THROW( Invalid_Reference );
5162 if ( CUR.opcode & 1 )
5163 R = CUR_fast_dualproj( &CUR.zp2.org[L] );
5165 R = CUR_fast_project( &CUR.zp2.cur[L] );
5191 if ( BOUNDS( L, CUR.zp2.n_points ) )
5193 if ( CUR.pedantic_hinting )
5194 CUR.error =
FT_THROW( Invalid_Reference );
5198 K = CUR_fast_project( &CUR.zp2.cur[L] );
5200 CUR_Func_move( &CUR.zp2, L, args[1] - K );
5204 if ( CUR.GS.gep2 == 0 )
5205 CUR.zp2.org[L] = CUR.zp2.cur[L];
5234 if ( BOUNDS( L, CUR.zp0.n_points ) ||
5235 BOUNDS( K, CUR.zp1.n_points ) )
5237 if ( CUR.pedantic_hinting )
5238 CUR.error =
FT_THROW( Invalid_Reference );
5243 if ( CUR.opcode & 1 )
5244 D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K );
5249 if ( CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 )
5255 D = CUR_Func_dualproj( vec1, vec2 );
5263 if ( CUR.metrics.x_scale == CUR.metrics.y_scale )
5266 D = CUR_Func_dualproj( vec1, vec2 );
5267 D =
FT_MulFix( D, CUR.metrics.x_scale );
5274 vec.
x =
FT_MulFix( vec1->
x - vec2->
x, CUR.metrics.x_scale );
5275 vec.
y =
FT_MulFix( vec1->
y - vec2->
y, CUR.metrics.y_scale );
5277 D = CUR_fast_dualproj( &vec );
5283 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 5285 if ( CUR.ignore_x_mode &&
FT_ABS( D ) == 64 )
5300 Ins_SDPVTL( INS_ARG )
5304 FT_Int aOpc = CUR.opcode;
5310 if ( BOUNDS( p2, CUR.zp1.n_points ) ||
5311 BOUNDS( p1, CUR.zp2.n_points ) )
5313 if ( CUR.pedantic_hinting )
5314 CUR.error =
FT_THROW( Invalid_Reference );
5331 if ( A == 0 && B == 0 )
5338 if ( ( aOpc & 1 ) != 0 )
5345 NORMalize( A, B, &CUR.GS.dualVector );
5356 if ( ( aOpc & 1 ) != 0 )
5363 NORMalize( A, B, &CUR.GS.projVector );
5365 GUESS_VECTOR( freeVector );
5380 switch ( (
FT_Int)args[0] )
5383 CUR.zp0 = CUR.twilight;
5391 if ( CUR.pedantic_hinting )
5392 CUR.error =
FT_THROW( Invalid_Reference );
5409 switch ( (
FT_Int)args[0] )
5412 CUR.zp1 = CUR.twilight;
5420 if ( CUR.pedantic_hinting )
5421 CUR.error =
FT_THROW( Invalid_Reference );
5438 switch ( (
FT_Int)args[0] )
5441 CUR.zp2 = CUR.twilight;
5449 if ( CUR.pedantic_hinting )
5450 CUR.error =
FT_THROW( Invalid_Reference );
5467 switch ( (
FT_Int)args[0] )
5470 CUR.zp0 = CUR.twilight;
5478 if ( CUR.pedantic_hinting )
5479 CUR.error =
FT_THROW( Invalid_Reference );
5499 Ins_INSTCTRL( INS_ARG )
5507 if ( K < 1 || K > 2 )
5509 if ( CUR.pedantic_hinting )
5510 CUR.error =
FT_THROW( Invalid_Reference );
5517 CUR.GS.instruct_control =
FT_BOOL(
5529 Ins_SCANCTRL( INS_ARG )
5535 A = (
FT_Int)( args[0] & 0xFF );
5539 CUR.GS.scan_control =
TRUE;
5544 CUR.GS.scan_control =
FALSE;
5548 if ( ( args[0] & 0x100 ) != 0 && CUR.tt_metrics.ppem <= A )
5549 CUR.GS.scan_control =
TRUE;
5551 if ( ( args[0] & 0x200 ) != 0 && CUR.tt_metrics.rotated )
5552 CUR.GS.scan_control =
TRUE;
5554 if ( ( args[0] & 0x400 ) != 0 && CUR.tt_metrics.stretched )
5555 CUR.GS.scan_control =
TRUE;
5557 if ( ( args[0] & 0x800 ) != 0 && CUR.tt_metrics.ppem > A )
5558 CUR.GS.scan_control =
FALSE;
5560 if ( ( args[0] & 0x1000 ) != 0 && CUR.tt_metrics.rotated )
5561 CUR.GS.scan_control =
FALSE;
5563 if ( ( args[0] & 0x2000 ) != 0 && CUR.tt_metrics.stretched )
5564 CUR.GS.scan_control =
FALSE;
5575 Ins_SCANTYPE( INS_ARG )
5578 CUR.GS.scan_type = (
FT_Int)args[0];
5598 Ins_FLIPPT( INS_ARG )
5605 if ( CUR.top < CUR.GS.loop )
5607 if ( CUR.pedantic_hinting )
5608 CUR.error =
FT_THROW( Too_Few_Arguments );
5612 while ( CUR.GS.loop > 0 )
5618 if ( BOUNDS( point, CUR.pts.n_points ) )
5620 if ( CUR.pedantic_hinting )
5622 CUR.error =
FT_THROW( Invalid_Reference );
5634 CUR.new_top = CUR.args;
5645 Ins_FLIPRGON( INS_ARG )
5653 if ( BOUNDS( K, CUR.pts.n_points ) ||
5654 BOUNDS( L, CUR.pts.n_points ) )
5656 if ( CUR.pedantic_hinting )
5657 CUR.error =
FT_THROW( Invalid_Reference );
5661 for ( I = L; I <= K; I++ )
5673 Ins_FLIPRGOFF( INS_ARG )
5681 if ( BOUNDS( K, CUR.pts.n_points ) ||
5682 BOUNDS( L, CUR.pts.n_points ) )
5684 if ( CUR.pedantic_hinting )
5685 CUR.error =
FT_THROW( Invalid_Reference );
5689 for ( I = L; I <= K; I++ )
5705 if ( CUR.opcode & 1 )
5718 if ( CUR.pedantic_hinting )
5719 CUR.error =
FT_THROW( Invalid_Reference );
5727 d = CUR_Func_project( zp.
cur + p, zp.
org + p );
5729 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 5730 if ( CUR.face->unpatented_hinting )
5732 if ( CUR.GS.both_x_axis )
5760 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 5761 if ( CUR.face->unpatented_hinting )
5763 if ( CUR.GS.both_x_axis )
5765 CUR.zp2.cur[point].x += dx;
5771 CUR.zp2.cur[point].y += dy;
5779 if ( CUR.GS.freeVector.x != 0 )
5781 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 5782 if ( !CUR.ignore_x_mode ||
5783 ( CUR.ignore_x_mode &&
5784 ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_MOVE_ZP2 ) ) )
5786 CUR.zp2.cur[point].x += dx;
5791 if ( CUR.GS.freeVector.y != 0 )
5793 CUR.zp2.cur[point].y += dy;
5819 if ( CUR.top < CUR.GS.loop )
5821 if ( CUR.pedantic_hinting )
5822 CUR.error =
FT_THROW( Invalid_Reference );
5826 if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
5829 while ( CUR.GS.loop > 0 )
5834 if ( BOUNDS( point, CUR.zp2.n_points ) )
5836 if ( CUR.pedantic_hinting )
5838 CUR.error =
FT_THROW( Invalid_Reference );
5843 MOVE_Zp2_Point( point, dx, dy,
TRUE );
5850 CUR.new_top = CUR.args;
5876 bounds = ( CUR.GS.gep2 == 0 ) ? 1 : CUR.zp2.n_contours;
5878 if ( BOUNDS( contour, bounds ) )
5880 if ( CUR.pedantic_hinting )
5881 CUR.error =
FT_THROW( Invalid_Reference );
5885 if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
5891 start = (
FT_UShort)( CUR.zp2.contours[contour - 1] + 1 -
5892 CUR.zp2.first_point );
5895 if ( CUR.GS.gep2 == 0 )
5896 limit = CUR.zp2.n_points;
5898 limit = (
FT_UShort)( CUR.zp2.contours[contour] -
5899 CUR.zp2.first_point + 1 );
5901 for ( i = start; i <
limit; i++ )
5903 if ( zp.
cur != CUR.zp2.cur || refp != i )
5904 MOVE_Zp2_Point( i, dx, dy,
TRUE );
5926 if ( BOUNDS( args[0], 2 ) )
5928 if ( CUR.pedantic_hinting )
5929 CUR.error =
FT_THROW( Invalid_Reference );
5933 if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
5940 if ( CUR.GS.gep2 == 0 )
5942 else if ( CUR.GS.gep2 == 1 && CUR.zp2.n_contours > 0 )
5943 limit = (
FT_UShort)( CUR.zp2.contours[CUR.zp2.n_contours - 1] + 1 );
5948 for ( i = 0; i <
limit; i++ )
5950 if ( zp.
cur != CUR.zp2.cur || refp != i )
5951 MOVE_Zp2_Point( i, dx, dy,
FALSE );
5963 Ins_SHPIX( INS_ARG )
5967 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 5972 if ( CUR.top < CUR.GS.loop + 1 )
5974 if ( CUR.pedantic_hinting )
5975 CUR.error =
FT_THROW( Invalid_Reference );
5979 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 5980 if ( CUR.face->unpatented_hinting )
5982 if ( CUR.GS.both_x_axis )
5996 dx = TT_MulFix14( (
FT_UInt32)args[0], CUR.GS.freeVector.x );
5997 dy = TT_MulFix14( (
FT_UInt32)args[0], CUR.GS.freeVector.y );
6000 while ( CUR.GS.loop > 0 )
6006 if ( BOUNDS( point, CUR.zp2.n_points ) )
6008 if ( CUR.pedantic_hinting )
6010 CUR.error =
FT_THROW( Invalid_Reference );
6015 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6025 if ( CUR.ignore_x_mode )
6028 if ( CUR.GS.freeVector.y != 0 )
6029 B1 = CUR.zp2.cur[point].y;
6031 B1 = CUR.zp2.cur[point].x;
6033 if ( CUR.GS.freeVector.y != 0 &&
6034 ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_INLINE_DELTAS ) )
6037 if ( !CUR.face->sph_compatibility_mode &&
6038 CUR.GS.freeVector.y != 0 )
6039 MOVE_Zp2_Point( point, dx, dy,
TRUE );
6041 else if ( CUR.face->sph_compatibility_mode )
6043 if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
6049 if ( !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
6050 ( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) ||
6052 ( CUR.sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) )
6053 MOVE_Zp2_Point( point, dx, dy,
TRUE );
6057 if ( CUR.GS.freeVector.y != 0 )
6058 B2 = CUR.zp2.cur[point].y;
6060 B2 = CUR.zp2.cur[point].x;
6063 if ( ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
6064 CUR.GS.freeVector.y != 0 &&
6068 ( CUR.face->sph_compatibility_mode &&
6069 CUR.GS.freeVector.y != 0 &&
6073 MOVE_Zp2_Point( point, -dx, -dy,
TRUE );
6076 MOVE_Zp2_Point( point, dx, dy,
TRUE );
6080 MOVE_Zp2_Point( point, dx, dy,
TRUE );
6088 CUR.new_top = CUR.args;
6099 Ins_MSIRP( INS_ARG )
6103 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6107 control_value_cutin = CUR.GS.control_value_cutin;
6109 if ( CUR.ignore_x_mode &&
6110 CUR.GS.freeVector.x != 0 &&
6111 !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
6112 control_value_cutin = 0;
6117 if ( BOUNDS( point, CUR.zp1.n_points ) ||
6118 BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
6120 if ( CUR.pedantic_hinting )
6121 CUR.error =
FT_THROW( Invalid_Reference );
6127 if ( CUR.GS.gep1 == 0 )
6129 CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];
6130 CUR_Func_move_orig( &CUR.zp1, point, args[1] );
6131 CUR.zp1.cur[point] = CUR.zp1.org[point];
6134 distance = CUR_Func_project( CUR.zp1.cur + point,
6135 CUR.zp0.cur + CUR.GS.rp0 );
6137 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6139 if ( CUR.ignore_x_mode &&
6140 CUR.GS.freeVector.x != 0 &&
6141 FT_ABS( distance - args[1] ) >= control_value_cutin )
6145 CUR_Func_move( &CUR.zp1, point, args[1] - distance );
6147 CUR.GS.rp1 = CUR.GS.rp0;
6150 if ( ( CUR.opcode & 1 ) != 0 )
6171 if ( BOUNDS( point, CUR.zp0.n_points ) )
6173 if ( CUR.pedantic_hinting )
6174 CUR.error =
FT_THROW( Invalid_Reference );
6178 if ( ( CUR.opcode & 1 ) != 0 )
6180 cur_dist = CUR_fast_project( &CUR.zp0.cur[point] );
6181 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6182 if ( CUR.ignore_x_mode &&
6183 CUR.GS.freeVector.x != 0 )
6184 distance = ROUND_None(
6186 CUR.tt_metrics.compensations[0] ) - cur_dist;
6189 distance = CUR_Func_round(
6191 CUR.tt_metrics.compensations[0] ) - cur_dist;
6196 CUR_Func_move( &CUR.zp0, point, distance );
6219 control_value_cutin = CUR.GS.control_value_cutin;
6223 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6224 if ( CUR.ignore_x_mode &&
6225 CUR.GS.freeVector.x != 0 &&
6226 !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
6227 control_value_cutin = 0;
6230 if ( BOUNDS( point, CUR.zp0.n_points ) ||
6231 BOUNDSL( cvtEntry, CUR.cvtSize ) )
6233 if ( CUR.pedantic_hinting )
6234 CUR.error =
FT_THROW( Invalid_Reference );
6258 distance = CUR_Func_read_cvt( cvtEntry );
6260 if ( CUR.GS.gep0 == 0 )
6262 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6265 if ( !CUR.ignore_x_mode || !CUR.face->sph_compatibility_mode )
6267 CUR.zp0.org[point].x = TT_MulFix14( (
FT_UInt32)distance,
6268 CUR.GS.freeVector.x );
6269 CUR.zp0.org[point].y = TT_MulFix14( (
FT_UInt32)distance,
6270 CUR.GS.freeVector.y ),
6271 CUR.zp0.cur[point] = CUR.zp0.org[point];
6273 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6274 if ( CUR.ignore_x_mode &&
6275 ( CUR.sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) &&
6277 CUR.GS.freeVector.y != 0 )
6281 org_dist = CUR_fast_project( &CUR.zp0.cur[point] );
6283 if ( ( CUR.opcode & 1 ) != 0 )
6285 if (
FT_ABS( distance - org_dist ) > control_value_cutin )
6286 distance = org_dist;
6288 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6289 if ( CUR.ignore_x_mode &&
6290 CUR.GS.freeVector.x != 0 )
6291 distance = ROUND_None( distance,
6292 CUR.tt_metrics.compensations[0] );
6295 distance = CUR_Func_round( distance,
6296 CUR.tt_metrics.compensations[0] );
6299 CUR_Func_move( &CUR.zp0, point, distance - org_dist );
6320 minimum_distance = CUR.GS.minimum_distance;
6322 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6323 if ( CUR.ignore_x_mode &&
6324 CUR.GS.freeVector.x != 0 &&
6325 !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
6326 minimum_distance = 0;
6332 if ( BOUNDS( point, CUR.zp1.n_points ) ||
6333 BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
6335 if ( CUR.pedantic_hinting )
6336 CUR.error =
FT_THROW( Invalid_Reference );
6345 if ( CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 )
6351 org_dist = CUR_Func_dualproj( vec1, vec2 );
6359 if ( CUR.metrics.x_scale == CUR.metrics.y_scale )
6362 org_dist = CUR_Func_dualproj( vec1, vec2 );
6363 org_dist =
FT_MulFix( org_dist, CUR.metrics.x_scale );
6370 vec.
x =
FT_MulFix( vec1->
x - vec2->
x, CUR.metrics.x_scale );
6371 vec.
y =
FT_MulFix( vec1->
y - vec2->
y, CUR.metrics.y_scale );
6373 org_dist = CUR_fast_dualproj( &vec );
6379 if (
FT_ABS( org_dist - CUR.GS.single_width_value ) <
6380 CUR.GS.single_width_cutin )
6382 if ( org_dist >= 0 )
6383 org_dist = CUR.GS.single_width_value;
6385 org_dist = -CUR.GS.single_width_value;
6390 if ( ( CUR.opcode & 4 ) != 0 )
6392 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6393 if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 )
6394 distance = ROUND_None(
6396 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6399 distance = CUR_Func_round(
6401 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6404 distance = ROUND_None(
6406 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6410 if ( ( CUR.opcode & 8 ) != 0 )
6412 if ( org_dist >= 0 )
6414 if ( distance < minimum_distance )
6415 distance = minimum_distance;
6419 if ( distance > -minimum_distance )
6420 distance = -minimum_distance;
6426 org_dist = CUR_Func_project( CUR.zp1.cur + point,
6427 CUR.zp0.cur + CUR.GS.rp0 );
6429 CUR_Func_move( &CUR.zp1, point, distance - org_dist );
6432 CUR.GS.rp1 = CUR.GS.rp0;
6435 if ( ( CUR.opcode & 16 ) != 0 )
6456 control_value_cutin,
6458 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6465 minimum_distance = CUR.GS.minimum_distance;
6466 control_value_cutin = CUR.GS.control_value_cutin;
6468 cvtEntry = (
FT_ULong)( args[1] + 1 );
6470 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6471 if ( CUR.ignore_x_mode &&
6472 CUR.GS.freeVector.x != 0 &&
6473 !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
6474 control_value_cutin = minimum_distance = 0;
6479 if ( BOUNDS( point, CUR.zp1.n_points ) ||
6480 BOUNDSL( cvtEntry, CUR.cvtSize + 1 ) ||
6481 BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
6483 if ( CUR.pedantic_hinting )
6484 CUR.error =
FT_THROW( Invalid_Reference );
6491 cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 );
6492 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6493 if ( CUR.ignore_x_mode &&
6494 ( CUR.sph_tweak_flags & SPH_TWEAK_MIRP_CVT_ZERO ) )
6500 if (
FT_ABS( cvt_dist - CUR.GS.single_width_value ) <
6501 CUR.GS.single_width_cutin )
6503 if ( cvt_dist >= 0 )
6504 cvt_dist = CUR.GS.single_width_value;
6506 cvt_dist = -CUR.GS.single_width_value;
6511 if ( CUR.GS.gep1 == 0 )
6513 CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
6515 CUR.GS.freeVector.x );
6516 CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
6518 CUR.GS.freeVector.y );
6519 CUR.zp1.cur[point] = CUR.zp1.org[point];
6522 org_dist = CUR_Func_dualproj( &CUR.zp1.org[point],
6523 &CUR.zp0.org[CUR.GS.rp0] );
6524 cur_dist = CUR_Func_project ( &CUR.zp1.cur[point],
6525 &CUR.zp0.cur[CUR.GS.rp0] );
6529 if ( CUR.GS.auto_flip )
6531 if ( ( org_dist ^ cvt_dist ) < 0 )
6532 cvt_dist = -cvt_dist;
6534 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6535 if ( CUR.ignore_x_mode &&
6536 CUR.GS.freeVector.y != 0 &&
6537 ( CUR.sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
6539 if ( cur_dist < -64 )
6541 else if ( cur_dist > 64 && cur_dist < 84 )
6547 if ( ( CUR.opcode & 4 ) != 0 )
6552 if ( CUR.GS.gep0 == CUR.GS.gep1 )
6566 if (
FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
6567 cvt_dist = org_dist;
6570 distance = CUR_Func_round(
6572 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6575 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6578 if ( CUR.ignore_x_mode && CUR.GS.gep0 == CUR.GS.gep1 )
6580 if (
FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
6581 cvt_dist = org_dist;
6583 distance = ROUND_None(
6585 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6588 distance = ROUND_None(
6590 CUR.tt_metrics.compensations[CUR.opcode & 3] );
6595 if ( ( CUR.opcode & 8 ) != 0 )
6597 if ( org_dist >= 0 )
6599 if ( distance < minimum_distance )
6600 distance = minimum_distance;
6604 if ( distance > -minimum_distance )
6605 distance = -minimum_distance;
6609 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6610 B1 = CUR.zp1.cur[point].y;
6613 if ( CUR.ignore_x_mode &&
6614 CUR.GS.freeVector.y != 0 &&
6615 ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )
6616 distance =
FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;
6618 if ( CUR.ignore_x_mode &&
6619 CUR.GS.freeVector.y != 0 &&
6620 ( CUR.opcode & 16 ) == 0 &&
6621 ( CUR.opcode & 8 ) == 0 &&
6622 ( CUR.sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )
6626 CUR_Func_move( &CUR.zp1, point, distance - cur_dist );
6628 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6629 B2 = CUR.zp1.cur[point].y;
6632 if ( CUR.ignore_x_mode )
6634 if ( CUR.face->sph_compatibility_mode &&
6635 CUR.GS.freeVector.y != 0 &&
6638 reverse_move =
TRUE;
6640 if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
6641 CUR.GS.freeVector.y != 0 &&
6644 reverse_move =
TRUE;
6646 if ( ( CUR.sph_tweak_flags &
6647 SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES ) &&
6649 FT_ABS( B1 - B2 ) >= 64 )
6650 reverse_move =
TRUE;
6654 CUR_Func_move( &CUR.zp1, point, -( distance - cur_dist ) );
6659 CUR.GS.rp1 = CUR.GS.rp0;
6661 if ( ( CUR.opcode & 16 ) != 0 )
6675 Ins_ALIGNRP( INS_ARG )
6683 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 6684 if ( CUR.ignore_x_mode &&
6686 ( CUR.sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) )
6688 CUR.error =
FT_THROW( Invalid_Reference );
6693 if ( CUR.top < CUR.GS.loop ||
6694 BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
6696 if ( CUR.pedantic_hinting )
6697 CUR.error =
FT_THROW( Invalid_Reference );
6701 while ( CUR.GS.loop > 0 )
6707 if ( BOUNDS( point, CUR.zp1.n_points ) )
6709 if ( CUR.pedantic_hinting )
6711 CUR.error =
FT_THROW( Invalid_Reference );
6717 distance = CUR_Func_project( CUR.zp1.cur + point,
6718 CUR.zp0.cur + CUR.GS.rp0 );
6720 CUR_Func_move( &CUR.zp1, point, -distance );
6728 CUR.new_top = CUR.args;
6739 Ins_ISECT( INS_ARG )
6763 if ( BOUNDS( b0, CUR.zp0.n_points ) ||
6764 BOUNDS( b1, CUR.zp0.n_points ) ||
6765 BOUNDS( a0, CUR.zp1.n_points ) ||
6766 BOUNDS( a1, CUR.zp1.n_points ) ||
6767 BOUNDS( point, CUR.zp2.n_points ) )
6769 if ( CUR.pedantic_hinting )
6770 CUR.error =
FT_THROW( Invalid_Reference );
6776 dbx = CUR.zp0.cur[b1].x - CUR.zp0.cur[b0].x;
6777 dby = CUR.zp0.cur[b1].y - CUR.zp0.cur[b0].y;
6779 dax = CUR.zp1.cur[a1].x - CUR.zp1.cur[a0].x;
6780 day = CUR.zp1.cur[a1].y - CUR.zp1.cur[a0].y;
6782 dx = CUR.zp0.cur[b0].x - CUR.zp1.cur[a0].x;
6783 dy = CUR.zp0.cur[b0].y - CUR.zp1.cur[a0].y;
6787 discriminant =
FT_MulDiv( dax, -dby, 0x40 ) +
6789 dotproduct =
FT_MulDiv( dax, dbx, 0x40 ) +
6800 if ( 19 *
FT_ABS( discriminant ) >
FT_ABS( dotproduct ) )
6807 CUR.zp2.cur[point].x = CUR.zp1.cur[a0].x + R.
x;
6808 CUR.zp2.cur[point].y = CUR.zp1.cur[a0].y + R.
y;
6814 CUR.zp2.cur[point].x = ( CUR.zp1.cur[a0].x +
6817 CUR.zp0.cur[b1].x ) / 4;
6818 CUR.zp2.cur[point].y = ( CUR.zp1.cur[a0].y +
6821 CUR.zp0.cur[b1].y ) / 4;
6833 Ins_ALIGNPTS( INS_ARG )
6842 if ( BOUNDS( p1, CUR.zp1.n_points ) ||
6843 BOUNDS( p2, CUR.zp0.n_points ) )
6845 if ( CUR.pedantic_hinting )
6846 CUR.error =
FT_THROW( Invalid_Reference );
6850 distance = CUR_Func_project( CUR.zp0.cur + p2,
6851 CUR.zp1.cur + p1 ) / 2;
6853 CUR_Func_move( &CUR.zp1, p1, distance );
6854 CUR_Func_move( &CUR.zp0, p2, -distance );
6878 if ( CUR.top < CUR.GS.loop )
6880 if ( CUR.pedantic_hinting )
6881 CUR.error =
FT_THROW( Invalid_Reference );
6890 twilight = CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 || CUR.GS.gep2 == 0;
6892 if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) )
6894 if ( CUR.pedantic_hinting )
6895 CUR.error =
FT_THROW( Invalid_Reference );
6900 orus_base = &CUR.zp0.org[CUR.GS.rp1];
6902 orus_base = &CUR.zp0.orus[CUR.GS.rp1];
6904 cur_base = &CUR.zp0.cur[CUR.GS.rp1];
6910 if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) ||
6911 BOUNDS( CUR.GS.rp2, CUR.zp1.n_points ) )
6919 old_range = CUR_Func_dualproj( &CUR.zp1.org[CUR.GS.rp2],
6921 else if ( CUR.metrics.x_scale == CUR.metrics.y_scale )
6922 old_range = CUR_Func_dualproj( &CUR.zp1.orus[CUR.GS.rp2],
6929 vec.
x =
FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].x - orus_base->
x,
6930 CUR.metrics.x_scale );
6931 vec.
y =
FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].y - orus_base->
y,
6932 CUR.metrics.y_scale );
6934 old_range = CUR_fast_dualproj( &vec );
6937 cur_range = CUR_Func_project ( &CUR.zp1.cur[CUR.GS.rp2], cur_base );
6940 for ( ; CUR.GS.loop > 0; --CUR.GS.loop )
6947 if ( BOUNDS( point, CUR.zp2.n_points ) )
6949 if ( CUR.pedantic_hinting )
6951 CUR.error =
FT_THROW( Invalid_Reference );
6958 org_dist = CUR_Func_dualproj( &CUR.zp2.org[point], orus_base );
6959 else if ( CUR.metrics.x_scale == CUR.metrics.y_scale )
6960 org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base );
6966 vec.
x =
FT_MulFix( CUR.zp2.orus[point].x - orus_base->
x,
6967 CUR.metrics.x_scale );
6968 vec.
y =
FT_MulFix( CUR.zp2.orus[point].y - orus_base->
y,
6969 CUR.metrics.y_scale );
6971 org_dist = CUR_fast_dualproj( &vec );
6974 cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
6979 new_dist =
FT_MulDiv( org_dist, cur_range, old_range );
6992 new_dist = -org_dist;
6998 CUR_Func_move( &CUR.zp2, (
FT_UShort)point, new_dist - cur_dist );
7003 CUR.new_top = CUR.args;
7022 if ( BOUNDS( point, CUR.zp0.n_points ) )
7024 if ( CUR.pedantic_hinting )
7025 CUR.error =
FT_THROW( Invalid_Reference );
7031 if ( CUR.GS.freeVector.x != 0 )
7034 if ( CUR.GS.freeVector.y != 0 )
7037 CUR.zp0.tags[point] &=
mask;
7042 typedef struct IUP_WorkerRec_
7049 } IUP_WorkerRec, *IUP_Worker;
7053 _iup_worker_shift( IUP_Worker worker,
7062 dx = worker->curs[
p].x - worker->orgs[
p].x;
7065 for ( i = p1; i <
p; i++ )
7066 worker->curs[i].x += dx;
7068 for ( i = p + 1; i <= p2; i++ )
7069 worker->curs[i].x += dx;
7075 _iup_worker_interpolate( IUP_Worker worker,
7082 FT_F26Dot6 orus1, orus2, org1, org2, delta1, delta2;
7088 if ( BOUNDS( ref1, worker->max_points ) ||
7089 BOUNDS( ref2, worker->max_points ) )
7092 orus1 = worker->orus[ref1].x;
7093 orus2 = worker->orus[ref2].x;
7095 if ( orus1 > orus2 )
7110 org1 = worker->orgs[ref1].x;
7111 org2 = worker->orgs[ref2].x;
7112 delta1 = worker->curs[ref1].x - org1;
7113 delta2 = worker->curs[ref2].x - org2;
7115 if ( orus1 == orus2 )
7118 for ( i = p1; i <= p2; i++ )
7128 worker->curs[
i].x =
x;
7138 for ( i = p1; i <= p2; i++ )
7146 else if ( x >= org2 )
7154 scale =
FT_DivFix( org2 + delta2 - ( org1 + delta1 ),
7158 x = ( org1 + delta1 ) +
7159 FT_MulFix( worker->orus[i].x - orus1, scale );
7161 worker->curs[
i].x =
x;
7192 if ( CUR.pts.n_contours == 0 )
7195 if ( CUR.opcode & 1 )
7198 V.orgs = CUR.pts.org;
7199 V.curs = CUR.pts.cur;
7200 V.orus = CUR.pts.orus;
7209 V.max_points = CUR.pts.n_points;
7214 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 7215 if ( CUR.ignore_x_mode )
7218 if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP )
7225 end_point = CUR.pts.contours[contour] - CUR.pts.first_point;
7226 first_point = point;
7228 if ( BOUNDS ( end_point, CUR.pts.n_points ) )
7229 end_point = CUR.pts.n_points - 1;
7231 while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 )
7234 if ( point <= end_point )
7236 first_touched = point;
7237 cur_touched = point;
7241 while ( point <= end_point )
7243 if ( ( CUR.pts.tags[point] & mask ) != 0 )
7245 _iup_worker_interpolate( &V,
7250 cur_touched = point;
7256 if ( cur_touched == first_touched )
7257 _iup_worker_shift( &V, first_point, end_point, cur_touched );
7260 _iup_worker_interpolate( &V,
7266 if ( first_touched > 0 )
7267 _iup_worker_interpolate( &V,
7275 }
while ( contour < CUR.pts.n_contours );
7286 Ins_DELTAP( INS_ARG )
7292 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 7297 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 7299 if ( CUR.face->unpatented_hinting )
7306 if ( CUR.pedantic_hinting )
7307 CUR.error =
FT_THROW( Too_Few_Arguments );
7312 CUR.new_top = CUR.args;
7320 for ( k = 1; k <= nump; k++ )
7324 if ( CUR.pedantic_hinting )
7325 CUR.error =
FT_THROW( Too_Few_Arguments );
7333 B = CUR.stack[CUR.args];
7341 if ( !BOUNDS( A, CUR.zp0.n_points ) )
7345 switch ( CUR.opcode )
7359 C += CUR.GS.delta_base;
7361 if ( CURRENT_Ppem() == (
FT_Long)C )
7366 B = B * 64 / ( 1L << CUR.GS.delta_shift );
7368 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 7376 if ( !CUR.ignore_x_mode ||
7377 ( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) ||
7378 ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) )
7379 CUR_Func_move( &CUR.zp0, A, B );
7382 else if ( CUR.ignore_x_mode )
7384 if ( CUR.GS.freeVector.y != 0 )
7385 B1 = CUR.zp0.cur[A].y;
7387 B1 = CUR.zp0.cur[A].x;
7391 if ( !CUR.face->sph_compatibility_mode &&
7392 CUR.GS.freeVector.y != 0 )
7393 CUR_Func_move( &CUR.zp0, A, B );
7398 if ( CUR.face->sph_compatibility_mode &&
7399 !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) )
7402 B1 = CUR.zp0.cur[A].y;
7404 if ( ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )
7409 if ( !CUR.iup_called &&
7411 CUR_Func_move( &CUR.zp0, A, B );
7414 B2 = CUR.zp0.cur[A].y;
7417 if ( CUR.GS.freeVector.y != 0 &&
7418 ( ( CUR.face->sph_compatibility_mode &&
7420 ( B2 & 63 ) != 0 ) ||
7421 ( ( CUR.sph_tweak_flags &
7422 SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
7424 ( B2 & 63 ) != 0 ) ) )
7425 CUR_Func_move( &CUR.zp0, A, -B );
7428 CUR_Func_move( &CUR.zp0, A, B );
7433 if ( CUR.pedantic_hinting )
7434 CUR.error =
FT_THROW( Invalid_Reference );
7438 CUR.new_top = CUR.args;
7449 Ins_DELTAC( INS_ARG )
7456 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 7458 if ( CUR.face->unpatented_hinting )
7465 if ( CUR.pedantic_hinting )
7466 CUR.error =
FT_THROW( Too_Few_Arguments );
7471 CUR.new_top = CUR.args;
7478 for ( k = 1; k <= nump; k++ )
7482 if ( CUR.pedantic_hinting )
7483 CUR.error =
FT_THROW( Too_Few_Arguments );
7490 A = (
FT_ULong)CUR.stack[CUR.args + 1];
7491 B = CUR.stack[CUR.args];
7493 if ( BOUNDSL( A, CUR.cvtSize ) )
7495 if ( CUR.pedantic_hinting )
7497 CUR.error =
FT_THROW( Invalid_Reference );
7505 switch ( CUR.opcode )
7519 C += CUR.GS.delta_base;
7521 if ( CURRENT_Ppem() == (
FT_Long)C )
7526 B = B * 64 / ( 1L << CUR.GS.delta_shift );
7528 CUR_Func_move_cvt( A, B );
7534 CUR.new_top = CUR.args;
7552 Ins_GETINFO( INS_ARG )
7559 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 7565 if ( ( args[0] & 1 ) != 0 && CUR.ignore_x_mode )
7567 K = CUR.rasterizer_version;
7568 FT_TRACE7((
"Setting rasterizer version %d\n",
7569 CUR.rasterizer_version ));
7573 if ( ( args[0] & 1 ) != 0 )
7581 if ( ( args[0] & 2 ) != 0 && CUR.tt_metrics.rotated )
7589 if ( ( args[0] & 4 ) != 0 && CUR.tt_metrics.stretched )
7597 if ( ( args[0] & 32 ) != 0 && CUR.grayscale )
7600 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 7601 if ( CUR.ignore_x_mode && CUR.rasterizer_version >= 35 )
7608 if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting )
7616 if ( ( args[0] & 64 ) != 0 &&
7617 CUR.subpixel_hinting &&
7618 CUR.rasterizer_version >= 37 )
7630 if ( ( args[0] & 128 ) != 0 && CUR.compatible_widths )
7639 if ( ( args[0] & 256 ) != 0 && CUR.symmetrical_smoothing )
7648 if ( ( args[0] & 512 ) != 0 && CUR.bgr )
7651 if ( CUR.rasterizer_version >= 38 )
7659 if ( ( args[0] & 1024 ) != 0 && CUR.subpixel_positioned )
7670 Ins_UNKNOWN( INS_ARG )
7678 for ( ; def <
limit; def++ )
7685 if ( CUR.callTop >= CUR.callSize )
7687 CUR.error =
FT_THROW( Stack_Overflow );
7691 call = CUR.callStack + CUR.callTop++;
7699 INS_Goto_CodeRange( def->
range, def->
start );
7701 CUR.step_ins =
FALSE;
7706 CUR.error =
FT_THROW( Invalid_Opcode );
7710 #ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH 7714 TInstruction_Function Instruct_Dispatch[256] =
8036 #ifdef TT_CONFIG_OPTION_STATIC_RASTER 8040 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 8041 CUR.iup_called =
FALSE;
8045 CUR.tt_metrics.ratio = 0;
8046 if ( CUR.metrics.x_ppem != CUR.metrics.y_ppem )
8049 CUR.func_read_cvt = Read_CVT_Stretched;
8050 CUR.func_write_cvt = Write_CVT_Stretched;
8051 CUR.func_move_cvt = Move_CVT_Stretched;
8056 CUR.func_read_cvt = Read_CVT;
8057 CUR.func_write_cvt = Write_CVT;
8058 CUR.func_move_cvt = Move_CVT;
8066 CUR.opcode = CUR.code[CUR.IP];
8072 if ( ( CUR.length = opcode_length[CUR.opcode] ) < 0 )
8074 if ( CUR.IP + 1 >= CUR.codeSize )
8075 goto LErrorCodeOverflow_;
8077 CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1];
8080 if ( CUR.IP + CUR.length > CUR.codeSize )
8081 goto LErrorCodeOverflow_;
8084 CUR.args = CUR.top - ( Pop_Push_Count[CUR.opcode] >> 4 );
8093 if ( CUR.pedantic_hinting )
8095 CUR.error =
FT_THROW( Too_Few_Arguments );
8100 for ( i = 0; i < Pop_Push_Count[CUR.opcode] >> 4; i++ )
8105 CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 );
8110 if ( CUR.new_top > CUR.stackSize )
8112 CUR.error =
FT_THROW( Stack_Overflow );
8116 CUR.step_ins =
TRUE;
8119 #ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH 8122 FT_Long* args = CUR.stack + CUR.args;
8126 #undef ARRAY_BOUND_ERROR 8127 #define ARRAY_BOUND_ERROR goto Set_Invalid_Ref 8142 AA = (
FT_Short)( ( opcode & 1 ) << 14 );
8147 CUR.GS.projVector.x = AA;
8148 CUR.GS.projVector.y = BB;
8150 CUR.GS.dualVector.x = AA;
8151 CUR.GS.dualVector.y = BB;
8155 GUESS_VECTOR( projVector );
8158 if ( ( opcode & 2 ) == 0 )
8160 CUR.GS.freeVector.x = AA;
8161 CUR.GS.freeVector.y = BB;
8165 GUESS_VECTOR( freeVector );
8315 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 8316 if ( !CUR.ignore_x_mode ||
8319 !( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) )
8339 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 8340 if ( CUR.ignore_x_mode )
8341 CUR.iup_called =
TRUE;
8400 CUR.error =
FT_THROW( Invalid_Reference );
8502 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING 8503 if ( !CUR.ignore_x_mode ||
8506 !( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) )
8676 if ( opcode >= 0xE0 )
8678 else if ( opcode >= 0xC0 )
8680 else if ( opcode >= 0xB8 )
8682 else if ( opcode >= 0xB0 )
8692 Instruct_Dispatch[CUR.opcode](
EXEC_ARG_ &CUR.stack[CUR.args] );
8698 switch ( CUR.error )
8701 case FT_ERR( Invalid_Opcode ):
8707 for ( ; def <
limit; def++ )
8714 if ( CUR.callTop >= CUR.callSize )
8716 CUR.error =
FT_THROW( Invalid_Reference );
8720 callrec = &CUR.callStack[CUR.callTop];
8736 CUR.error =
FT_THROW( Invalid_Opcode );
8754 CUR.top = CUR.new_top;
8757 CUR.IP += CUR.length;
8761 if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
8762 return FT_THROW( Execution_Too_Long );
8765 if ( CUR.IP >= CUR.codeSize )
8767 if ( CUR.callTop > 0 )
8769 CUR.error =
FT_THROW( Code_Overflow );
8775 }
while ( !CUR.instruction_trap );
8779 #ifdef TT_CONFIG_OPTION_STATIC_RASTER 8785 LErrorCodeOverflow_:
8786 CUR.error =
FT_THROW( Code_Overflow );
8790 #ifdef TT_CONFIG_OPTION_STATIC_RASTER 8797 if ( CUR.error && !CUR.instruction_trap )
8799 FT_TRACE1((
" The interpreter returned error 0x%x\n", CUR.error ));
GLenum GLuint GLenum GLsizei length
const TT_GraphicsState tt_default_graphics_state
void(* TT_Move_Func)(EXEC_OP_ TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance)
FT_DivFix(FT_Long a, FT_Long b)
for(n=1;n< outline->n_points;n++)
GLenum GLenum GLenum GLenum GLenum scale
FT_BEGIN_HEADER typedef signed long FT_Pos
GLboolean GLboolean GLboolean GLboolean a
fvec2 vec2
Defined as: 'typedef fvec2 vec2'. See also VL_PIPELINE_PRECISION.
GLfloat GLfloat GLfloat v2
GLint GLint GLint GLint GLint GLint y
#define TT_Round_To_Half_Grid
#define FT_CURVE_TAG_TOUCH_BOTH
#define TT_Round_Up_To_Grid
return FT_THROW(Missing_Property)
GLint GLint GLint GLint GLint x
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
TT_Interpreter interpreter
FT_F26Dot6(* TT_Round_Func)(EXEC_OP_ FT_F26Dot6 distance, FT_F26Dot6 compensation)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
GLboolean GLboolean GLboolean b
TT_New_Context(TT_Driver driver)
TT_Size_Metrics tt_metrics
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_CURVE_TAG_TOUCH_X
#define TT_Round_Super_45
#define FT_TRACE1(varformat)
GLenum GLuint GLint GLenum face
#define FT_ERROR(varformat)
#define TT_Round_Down_To_Grid
#define FT_ASSERT(condition)
TT_CodeRangeTable codeRangeTable
TT_MaxProfile max_profile
#define FT_PAD_ROUND(x, n)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define FT_ARRAY_MOVE(dest, source, count)
#define TT_Round_To_Double_Grid
#define FT_CURVE_TAG_TOUCH_Y
FT_UShort maxStackElements
FT_UShort maxSizeOfInstructions
#define FT_TRACE7(varformat)
#define FT_CALLBACK_DEF(x)
TT_Size_Metrics ttmetrics
GLsizei GLsizei GLfloat distance
GLsizei const GLfloat * value
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_F26Dot6(* TT_Project_Func)(EXEC_OP_ FT_Pos dx, FT_Pos dy)
#define FT_NEW_ARRAY(ptr, count)
FT_MulFix(FT_Long a, FT_Long b)
if(!abbox) return FT_THROW(Invalid_Argument)
#define FT_REALLOC(ptr, cursz, newsz)
FT_Hypot(FT_Fixed x, FT_Fixed y)
int def(FILE *source, FILE *dest, int level)
#define TT_MAX_CODE_RANGES
TT_RunIns(TT_ExecContext exec)