* src/pshinter/pshalgo.c (psh_hint_table_init): Simplify code.

This commit is contained in:
Werner Lemberg 2004-03-03 16:06:17 +00:00
parent bfb712fb36
commit ed279ac7ae
2 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,7 @@
2004-03-03 Werner Lemberg <wl@gnu.org>
* src/pshinter/pshalgo.c (psh_hint_table_init): Simplify code.
2004-03-02 Werner Lemberg <wl@gnu.org> 2004-03-02 Werner Lemberg <wl@gnu.org>
Add embedded bitmap support to CFF driver. Add embedded bitmap support to CFF driver.

View File

@ -35,8 +35,11 @@
#endif #endif
#define COMPUTE_INFLEXS /* compute inflection points to optimize "S" and others */ #define COMPUTE_INFLEXS /* compute inflection points to optimize `S' */
#define STRONGER /* slightly increase the contrast of smooth hinting */ /* and similar glyphs */
#define STRONGER /* slightly increase the contrast of smooth */
/* hinting */
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -46,13 +49,13 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* return true iff two stem hints overlap */ /* return true if two stem hints overlap */
static FT_Int static FT_Int
psh_hint_overlap( PSH_Hint hint1, psh_hint_overlap( PSH_Hint hint1,
PSH_Hint hint2 ) PSH_Hint hint2 )
{ {
return ( hint1->org_pos + hint1->org_len >= hint2->org_pos && return hint1->org_pos + hint1->org_len >= hint2->org_pos &&
hint2->org_pos + hint2->org_len >= hint1->org_pos ); hint2->org_pos + hint2->org_len >= hint1->org_pos;
} }
@ -89,7 +92,7 @@
} }
/* internal function used to record a new hint */ /* internal function to record a new hint */
static void static void
psh_hint_table_record( PSH_Hint_Table table, psh_hint_table_record( PSH_Hint_Table table,
FT_UInt idx ) FT_UInt idx )
@ -109,8 +112,8 @@
psh_hint_activate( hint ); psh_hint_activate( hint );
/* now scan the current active hint set in order to determine */ /* now scan the current active hint set to check */
/* if we are overlapping with another segment */ /* whether `hint' overlaps with another hint */
{ {
PSH_Hint* sorted = table->sort_global; PSH_Hint* sorted = table->sort_global;
FT_UInt count = table->num_hints; FT_UInt count = table->num_hints;
@ -172,12 +175,14 @@
PS_Mask_Table counter_masks, PS_Mask_Table counter_masks,
FT_Memory memory ) FT_Memory memory )
{ {
FT_UInt count = hints->num_hints; FT_UInt count;
FT_Error error; FT_Error error;
FT_UNUSED( counter_masks ); FT_UNUSED( counter_masks );
count = hints->num_hints;
/* allocate our tables */ /* allocate our tables */
if ( FT_NEW_ARRAY( table->sort, 2 * count ) || if ( FT_NEW_ARRAY( table->sort, 2 * count ) ||
FT_NEW_ARRAY( table->hints, count ) || FT_NEW_ARRAY( table->hints, count ) ||
@ -190,7 +195,7 @@
table->num_zones = 0; table->num_zones = 0;
table->zone = 0; table->zone = 0;
/* now, initialize the "hints" array */ /* initialize the `table->hints' array */
{ {
PSH_Hint write = table->hints; PSH_Hint write = table->hints;
PS_Hint read = hints->hints; PS_Hint read = hints->hints;
@ -204,30 +209,31 @@
} }
} }
/* we now need to determine the initial "parent" stems; first */ /* we now need to determine the initial `parent' stems; first */
/* activate the hints that are given by the initial hint masks */ /* activate the hints that are given by the initial hint masks */
if ( hint_masks ) if ( hint_masks )
{ {
FT_UInt Count = hint_masks->num_masks; PS_Mask mask = hint_masks->masks;
PS_Mask Mask = hint_masks->masks;
count = hint_masks->num_masks;
table->hint_masks = hint_masks; table->hint_masks = hint_masks;
for ( ; Count > 0; Count--, Mask++ ) for ( ; count > 0; count--, mask++ )
psh_hint_table_record_mask( table, Mask ); psh_hint_table_record_mask( table, mask );
} }
/* now, do a linear parse in case some hints were left alone */ /* finally, do a linear parse in case some hints were left alone */
if ( table->num_hints != table->max_hints ) if ( table->num_hints != table->max_hints )
{ {
FT_UInt Index, Count; FT_UInt idx;
FT_ERROR(( "psh_hint_table_init: missing/incorrect hint masks!\n" )); FT_ERROR(( "psh_hint_table_init: missing/incorrect hint masks!\n" ));
Count = table->max_hints;
for ( Index = 0; Index < Count; Index++ ) count = table->max_hints;
psh_hint_table_record( table, Index ); for ( idx = 0; idx < count; idx++ )
psh_hint_table_record( table, idx );
} }
Exit: Exit: