20 #include FT_FREETYPE_H
21 #include FT_INTERNAL_OBJECTS_H
22 #include FT_INTERNAL_DEBUG_H
23 #include FT_INTERNAL_CALC_H
31 #define FT_COMPONENT trace_pshrec
35 int ps_debug_no_horz_hints = 0;
36 int ps_debug_no_vert_hints = 0;
70 if ( new_max > old_max )
101 hint = table->
hints + count - 1;
141 FT_UInt new_max = ( count + 7 ) >> 3;
145 if ( new_max > old_max )
163 return mask->
bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) );
178 p = mask->
bytes + ( idx >> 3 );
179 p[0] = (
FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) );
205 p = mask->
bytes + ( idx >> 3 );
206 p[0] = (
FT_Byte)( p[0] | ( 0x80 >> ( idx & 7 ) ) );
222 for ( ; count > 0; count--, mask++ )
242 if ( new_max > old_max )
273 mask = table->
masks + count - 1;
303 mask = table->
masks + count - 1;
336 FT_Int rmask = 0x80 >> ( bit_pos & 7 );
342 for ( ; bit_count > 0; bit_count-- )
344 val = write[0] & ~wmask;
346 if ( read[0] & rmask )
387 count = ( count1 <= count2 ) ? count1 : count2;
388 for ( ; count >= 8; count -= 8 )
400 return ( p1[0] & p2[0] ) & ~( 0xFF >>
count );
416 if ( index1 > index2 )
423 if ( index1 < index2 && index1 >= 0 && index2 < (
FT_Int)table->
num_masks )
443 if ( count2 > count1 )
449 for ( pos = count1; pos < count2; pos++ )
455 write = mask1->
bytes;
456 pos = (
FT_UInt)( ( count2 + 7 ) >> 3 );
458 for ( ; pos > 0; pos-- )
460 write[0] = (
FT_Byte)( write[0] | read[0] );
480 mask2[delta] = dummy;
486 FT_TRACE0((
"ps_mask_table_merge: ignoring invalid indices (%d,%d)\n",
505 for ( index1 = table->
num_masks - 1; index1 > 0; index1-- )
507 for ( index2 = index1 - 1; index2 >= 0; index2-- )
634 source_pos, source_bits, memory );
676 for ( idx = 0; idx <
max; idx++, hint++ )
678 if ( hint->pos == pos && hint->len == len )
727 for ( ; count > 0; count--, counter++ )
794 hints->error = PSH_Err_Ok;
804 hints->memory = memory;
818 hints->
error = PSH_Err_Ok;
826 hints->
error = PSH_Err_Invalid_Argument;
829 FT_TRACE0((
"ps_hints_open: invalid charstring type\n" ));
845 if ( dimension < 0 || dimension > 1 )
847 FT_TRACE0((
"ps_hints_stem: invalid dimension (%d) used\n",
849 dimension = ( dimension != 0 );
861 for ( ; count > 0; count--, stems += 2 )
872 FT_ERROR((
"ps_hints_stem: could not add stem"
873 " (%d,%d) to hints table\n", stems[0], stems[1] ));
883 FT_TRACE0((
"ps_hints_stem: called with invalid hint type (%d)\n",
909 if ( dimension < 0 || dimension > 1 )
911 FT_TRACE0((
"ps_hints_t1stem3: invalid dimension (%d) used\n",
913 dimension = ( dimension != 0 );
922 for ( count = 0; count < 3; count++, stems += 2 )
927 memory, &idx[count] );
940 FT_ERROR((
"ps_hints_t1stem3: called with invalid hint type\n" ));
941 error = PSH_Err_Invalid_Argument;
949 FT_ERROR((
"ps_hints_t1stem3: could not add counter stems to table\n" ));
982 error = PSH_Err_Invalid_Argument;
1003 if ( !hints->
error )
1012 if ( bit_count != count1 + count2 )
1015 " called with invalid bitcount %d (instead of %d)\n",
1016 bit_count, count1 + count2 ));
1024 end_point, memory );
1029 end_point, memory );
1048 if ( !hints->
error )
1057 if ( bit_count != count1 + count2 )
1060 " called with invalid bitcount %d (instead of %d)\n",
1061 bit_count, count1 + count2 ));
1093 error = hints->
error;
1109 ps_debug_hints = hints;
1192 for ( n = 0; n < count * 2; n++ )
1199 for ( n = 0; n < count * 2; n += 2 )
1200 stems[n + 1] = stems[n + 1] - stems[n];
GLenum GLsizei GLenum GLenum const GLvoid * table
typedefFT_BEGIN_HEADER struct PS_HintRec_ * PS_Hint
GLuint const GLfloat * val
static FT_Int ps_mask_table_test_intersect(PS_Mask_Table table, FT_Int index1, FT_Int index2)
FT_Error(* T2_Hints_ApplyFunc)(T2_Hints hints, FT_Outline *outline, PSH_Globals globals, FT_Render_Mode hint_mode)
static FT_Error ps_mask_table_last(PS_Mask_Table table, FT_Memory memory, PS_Mask *amask)
FT_BEGIN_HEADER typedef signed long FT_Pos
static void ps_hints_t1reset(PS_Hints hints, FT_UInt end_point)
static FT_Error ps_mask_table_alloc(PS_Mask_Table table, FT_Memory memory, PS_Mask *amask)
static FT_Error ps_dimension_add_counter(PS_Dimension dim, FT_Int hint1, FT_Int hint2, FT_Int hint3, FT_Memory memory)
static void ps_mask_clear_bit(PS_Mask mask, FT_Int idx)
#define FT_MEM_ZERO(dest, count)
static void ps_hints_stem(PS_Hints hints, FT_Int dimension, FT_UInt count, FT_Long *stems)
struct T2_HintsRec_ * T2_Hints
void(* T1_Hints_SetStem3Func)(T1_Hints hints, FT_UInt dimension, FT_Fixed *coords)
static void ps_mask_table_done(PS_Mask_Table table, FT_Memory memory)
void(* T1_Hints_SetStemFunc)(T1_Hints hints, FT_UInt dimension, FT_Fixed *coords)
static void ps_hint_table_done(PS_Hint_Table table, FT_Memory memory)
static void ps_hints_t1stem3(PS_Hints hints, FT_Int dimension, FT_Fixed *stems)
static void ps_mask_done(PS_Mask mask, FT_Memory memory)
ps_hints_init(PS_Hints hints, FT_Memory memory)
static FT_Int ps_mask_test_bit(PS_Mask mask, FT_Int idx)
#define FT_ERROR(varformat)
#define FT_PAD_CEIL(x, n)
static FT_Error ps_dimension_add_t1stem(PS_Dimension dim, FT_Int pos, FT_Int len, FT_Memory memory, FT_Int *aindex)
static FT_Error ps_dimension_end(PS_Dimension dim, FT_UInt end_point, FT_Memory memory)
static FT_Error ps_mask_ensure(PS_Mask mask, FT_UInt count, FT_Memory memory)
static FT_Error ps_mask_table_merge(PS_Mask_Table table, FT_Int index1, FT_Int index2, FT_Memory memory)
void(* T2_Hints_CounterFunc)(T2_Hints hints, FT_UInt bit_count, const FT_Byte *bytes)
static FT_Error ps_mask_table_set_bits(PS_Mask_Table table, const FT_Byte *source, FT_UInt bit_pos, FT_UInt bit_count, FT_Memory memory)
static void ps_hints_t2mask(PS_Hints hints, FT_UInt end_point, FT_UInt bit_count, const FT_Byte *bytes)
PS_DimensionRec dimension[2]
ps_hints_done(PS_Hints hints)
static void t1_hints_open(T1_Hints hints)
static void t2_hints_stems(T2_Hints hints, FT_Int dimension, FT_Int count, FT_Fixed *coords)
void(* T2_Hints_OpenFunc)(T2_Hints hints)
#define FT_TRACE0(varformat)
static FT_Error ps_hint_table_ensure(PS_Hint_Table table, FT_UInt count, FT_Memory memory)
static void ps_dimension_done(PS_Dimension dimension, FT_Memory memory)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
static void t2_hints_open(T2_Hints hints)
FT_Error(* T2_Hints_CloseFunc)(T2_Hints hints, FT_UInt end_point)
static FT_Error ps_dimension_set_mask_bits(PS_Dimension dim, const FT_Byte *source, FT_UInt source_pos, FT_UInt source_bits, FT_UInt end_point, FT_Memory memory)
static void t1_hints_stem(T1_Hints hints, FT_Int dimension, FT_Fixed *coords)
static FT_Error ps_mask_table_ensure(PS_Mask_Table table, FT_UInt count, FT_Memory memory)
static void ps_dimension_end_mask(PS_Dimension dim, FT_UInt end_point)
struct T1_HintsRec_ * T1_Hints
static FT_Error ps_mask_set_bit(PS_Mask mask, FT_Int idx, FT_Memory memory)
PS_Mask_TableRec counters
t2_hints_funcs_init(T2_Hints_FuncsRec *funcs)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
void(* T2_Hints_StemsFunc)(T2_Hints hints, FT_UInt dimension, FT_UInt count, FT_Fixed *coordinates)
void(* T1_Hints_ResetFunc)(T1_Hints hints, FT_UInt end_point)
FT_Error ps_hints_apply(PS_Hints ps_hints, FT_Outline *outline, PSH_Globals globals, FT_Render_Mode hint_mode)
EGLSurface EGLint EGLint y
enum PS_Hint_Type_ PS_Hint_Type
void(* T2_Hints_MaskFunc)(T2_Hints hints, FT_UInt end_point, FT_UInt bit_count, const FT_Byte *bytes)
void(* T1_Hints_OpenFunc)(T1_Hints hints)
FT_Error(* T1_Hints_CloseFunc)(T1_Hints hints, FT_UInt end_point)
t1_hints_funcs_init(T1_Hints_FuncsRec *funcs)
static FT_Error ps_mask_table_merge_all(PS_Mask_Table table, FT_Memory memory)
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
static FT_Error ps_hints_close(PS_Hints hints, FT_UInt end_point)
static FT_Error ps_hint_table_alloc(PS_Hint_Table table, FT_Memory memory, PS_Hint *ahint)
FT_Error(* T1_Hints_ApplyFunc)(T1_Hints hints, FT_Outline *outline, PSH_Globals globals, FT_Render_Mode hint_mode)
static void ps_dimension_init(PS_Dimension dimension)
GLsizei GLsizei GLchar * source
static void ps_hints_open(PS_Hints hints, PS_Hint_Type hint_type)
static FT_Error ps_dimension_reset_mask(PS_Dimension dim, FT_UInt end_point, FT_Memory memory)
static void ps_hints_t2counter(PS_Hints hints, FT_UInt bit_count, const FT_Byte *bytes)