mirror of https://github.com/freetype/freetype
* src/cff/cffgload.c, src/psaux/t1decode.c, src/pshinter/pshrec.c,
src/pshinter/ahalgo2.c, src/pshinter/pshglob.h: fixed a bug where the X and Y axis where inversed in the postscript hinter. this caused problem when displaying on non-square surfaces..
This commit is contained in:
parent
3a664fca14
commit
7c0d20814a
|
@ -1,5 +1,10 @@
|
|||
2001-12-21 David Turner <david@freetype.org>
|
||||
|
||||
* src/cff/cffgload.c, src/psaux/t1decode.c, src/pshinter/pshrec.c,
|
||||
src/pshinter/ahalgo2.c, src/pshinter/pshglob.h: fixed a bug where
|
||||
the X and Y axis where inversed in the postscript hinter. this
|
||||
caused problem when displaying on non-square surfaces..
|
||||
|
||||
* include/freetype/cache/ftcmanag.h, include/freetype/cache/ftcimage.h,
|
||||
include/freetype/cache/ftcsbits.h: updating documentation to better
|
||||
explain the use of the "anode" output parameter in lookup functions
|
||||
|
|
|
@ -1080,7 +1080,7 @@
|
|||
|
||||
if ( hinter )
|
||||
hinter->stems( hinter->hints,
|
||||
( op == cff_op_vstem || op == cff_op_vstemhm ),
|
||||
( op == cff_op_hstem || op == cff_op_hstemhm ),
|
||||
num_args / 2,
|
||||
args );
|
||||
|
||||
|
@ -1097,7 +1097,7 @@
|
|||
{
|
||||
if ( hinter )
|
||||
hinter->stems( hinter->hints,
|
||||
1,
|
||||
0,
|
||||
num_args / 2,
|
||||
args );
|
||||
|
||||
|
|
|
@ -1014,7 +1014,7 @@
|
|||
if ( hinter )
|
||||
{
|
||||
/* top[0] += builder->left_bearing.y; */
|
||||
hinter->stem( hinter->hints, 0, top );
|
||||
hinter->stem( hinter->hints, 1, top );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1024,7 +1024,7 @@
|
|||
|
||||
/* record horizontal counter-controlled hints */
|
||||
if ( hinter )
|
||||
hinter->stem3( hinter->hints, 0, top );
|
||||
hinter->stem3( hinter->hints, 1, top );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1035,7 +1035,7 @@
|
|||
if ( hinter )
|
||||
{
|
||||
top[0] += orig_x;
|
||||
hinter->stem( hinter->hints, 1, top );
|
||||
hinter->stem( hinter->hints, 0, top );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1051,7 +1051,7 @@
|
|||
top[0] += dx;
|
||||
top[2] += dx;
|
||||
top[4] += dx;
|
||||
hinter->stem3( hinter->hints, 1, top );
|
||||
hinter->stem3( hinter->hints, 0, top );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@
|
|||
ps2_simple_scale( PSH2_Hint_Table table,
|
||||
FT_Fixed scale,
|
||||
FT_Fixed delta,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
PSH2_Hint hint;
|
||||
FT_UInt count;
|
||||
|
@ -344,7 +344,7 @@
|
|||
hint->cur_len = FT_MulFix( hint->org_len, scale );
|
||||
|
||||
if ( ps2_debug_hint_func )
|
||||
ps2_debug_hint_func( hint, vertical );
|
||||
ps2_debug_hint_func( hint, dimension );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -353,9 +353,9 @@
|
|||
static void
|
||||
psh2_hint_align( PSH2_Hint hint,
|
||||
PSH_Globals globals,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
PSH_Dimension dim = &globals->dimension[vertical];
|
||||
PSH_Dimension dim = &globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
|
||||
|
@ -388,7 +388,7 @@
|
|||
align.align = 0;
|
||||
align.align_bot = align.align_top = 0;
|
||||
|
||||
if ( !vertical )
|
||||
if ( dimension == 1 )
|
||||
psh_blues_snap_stem( &globals->blues,
|
||||
hint->org_pos + hint->org_len,
|
||||
hint->org_pos,
|
||||
|
@ -425,7 +425,7 @@
|
|||
|
||||
/* ensure that parent is already fitted */
|
||||
if ( !psh2_hint_is_fitted( parent ) )
|
||||
psh2_hint_align( parent, globals, vertical );
|
||||
psh2_hint_align( parent, globals, dimension );
|
||||
|
||||
par_org_center = parent->org_pos + ( parent->org_len / 2);
|
||||
par_cur_center = parent->cur_pos + ( parent->cur_len / 2);
|
||||
|
@ -461,7 +461,7 @@
|
|||
|
||||
#ifdef DEBUG_HINTER
|
||||
if ( ps2_debug_hint_func )
|
||||
ps2_debug_hint_func( hint, vertical );
|
||||
ps2_debug_hint_func( hint, dimension );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -470,26 +470,26 @@
|
|||
static void
|
||||
psh2_hint_table_align_hints( PSH2_Hint_Table table,
|
||||
PSH_Globals globals,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
PSH2_Hint hint;
|
||||
FT_UInt count;
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
PSH_Dimension dim = &globals->dimension[vertical];
|
||||
PSH_Dimension dim = &globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
|
||||
|
||||
if ( ps_debug_no_vert_hints && vertical )
|
||||
if ( ps_debug_no_vert_hints && dimension == 0 )
|
||||
{
|
||||
ps2_simple_scale( table, scale, delta, vertical );
|
||||
ps2_simple_scale( table, scale, delta, dimension );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ps_debug_no_horz_hints && !vertical )
|
||||
if ( ps_debug_no_horz_hints && dimension == 1 )
|
||||
{
|
||||
ps2_simple_scale( table, scale, delta, vertical );
|
||||
ps2_simple_scale( table, scale, delta, dimension );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -498,7 +498,7 @@
|
|||
count = table->max_hints;
|
||||
|
||||
for ( ; count > 0; count--, hint++ )
|
||||
psh2_hint_align( hint, globals, vertical );
|
||||
psh2_hint_align( hint, globals, dimension );
|
||||
}
|
||||
|
||||
|
||||
|
@ -688,13 +688,13 @@
|
|||
psh2_hint_table_tune_outline( PSH2_Hint_Table table,
|
||||
FT_Outline* outline,
|
||||
PSH_Globals globals,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
|
||||
{
|
||||
FT_UInt count, first, last;
|
||||
PS_Mask_Table hint_masks = table->hint_masks;
|
||||
PS_Mask mask;
|
||||
PSH_Dimension dim = &globals->dimension[vertical];
|
||||
PSH_Dimension dim = &globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
|
||||
|
@ -716,7 +716,7 @@
|
|||
|
||||
|
||||
psh2_hint_table_activate_mask( table, mask );
|
||||
psh2_hint_table_optimize( table, globals, outline, vertical );
|
||||
psh2_hint_table_optimize( table, globals, outline, dimension );
|
||||
psh2_hint_table_setup_zones( table, scale, delta );
|
||||
last = mask->end_point;
|
||||
|
||||
|
@ -728,7 +728,7 @@
|
|||
FT_Pos x, *px;
|
||||
|
||||
|
||||
px = vertical ? &vec->x : &vec->y;
|
||||
px = dimension ? &vec->y : &vec->x;
|
||||
x = *px;
|
||||
|
||||
*px = psh2_hint_table_tune_coord( table, (FT_Int)x );
|
||||
|
@ -746,7 +746,7 @@
|
|||
vec = outline->points;
|
||||
count = outline->n_points;
|
||||
|
||||
if ( vertical )
|
||||
if ( dimension == 0 )
|
||||
{
|
||||
for ( ; count > 0; count--, vec++ )
|
||||
vec->x = FT_MulFix( vec->x, scale ) + delta;
|
||||
|
@ -999,7 +999,7 @@
|
|||
/* load outline point coordinates into hinter glyph */
|
||||
static void
|
||||
psh2_glyph_load_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
FT_Vector* vec = glyph->outline->points;
|
||||
PSH2_Point point = glyph->points;
|
||||
|
@ -1010,7 +1010,7 @@
|
|||
{
|
||||
point->flags &= PSH2_POINT_OFF | PSH2_POINT_SMOOTH;
|
||||
point->hint = 0;
|
||||
if ( vertical )
|
||||
if ( dimension == 0 )
|
||||
point->org_u = vec->x;
|
||||
else
|
||||
point->org_u = vec->y;
|
||||
|
@ -1026,7 +1026,7 @@
|
|||
/* save hinted point coordinates back to outline */
|
||||
static void
|
||||
psh2_glyph_save_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
FT_UInt n;
|
||||
PSH2_Point point = glyph->points;
|
||||
|
@ -1036,16 +1036,16 @@
|
|||
|
||||
for ( n = 0; n < glyph->num_points; n++ )
|
||||
{
|
||||
if ( vertical )
|
||||
if ( dimension == 0 )
|
||||
vec[n].x = point->cur_u;
|
||||
else
|
||||
vec[n].y = point->cur_u;
|
||||
|
||||
if ( psh2_point_is_strong( point ) )
|
||||
tags[n] |= vertical ? 32 : 64;
|
||||
tags[n] |= (dimension == 0) ? 32 : 64;
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
if ( vertical )
|
||||
if ( dimension == 0 )
|
||||
{
|
||||
point->cur_x = point->cur_u;
|
||||
point->flags_x = point->flags;
|
||||
|
@ -1115,16 +1115,16 @@
|
|||
/* find strong points in a glyph */
|
||||
static void
|
||||
psh2_glyph_find_strong_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
/* a point is strong if it is located on a stem */
|
||||
/* edge and has an "in" or "out" tangent to the hint's direction */
|
||||
{
|
||||
PSH2_Hint_Table table = &glyph->hint_tables[vertical];
|
||||
PSH2_Hint_Table table = &glyph->hint_tables[dimension];
|
||||
PS_Mask mask = table->hint_masks->masks;
|
||||
FT_UInt num_masks = table->hint_masks->num_masks;
|
||||
FT_UInt first = 0;
|
||||
FT_Int major_dir = vertical ? PSH2_DIR_UP : PSH2_DIR_RIGHT;
|
||||
FT_Int major_dir = dimension == 0 ? PSH2_DIR_UP : PSH2_DIR_RIGHT;
|
||||
|
||||
|
||||
/* process secondary hints to "selected" points */
|
||||
|
@ -1186,9 +1186,9 @@
|
|||
/* interpolate strong points with the help of hinted coordinates */
|
||||
static void
|
||||
psh2_glyph_interpolate_strong_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
PSH_Dimension dim = &glyph->globals->dimension[vertical];
|
||||
PSH_Dimension dim = &glyph->globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
|
||||
|
||||
|
@ -1231,10 +1231,10 @@
|
|||
|
||||
static void
|
||||
psh2_glyph_interpolate_normal_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
#if 1
|
||||
PSH_Dimension dim = &glyph->globals->dimension[vertical];
|
||||
PSH_Dimension dim = &glyph->globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
|
||||
|
||||
|
@ -1344,9 +1344,9 @@
|
|||
/* interpolate other points */
|
||||
static void
|
||||
psh2_glyph_interpolate_other_points( PSH2_Glyph glyph,
|
||||
FT_Int vertical )
|
||||
FT_Int dimension )
|
||||
{
|
||||
PSH_Dimension dim = &glyph->globals->dimension[vertical];
|
||||
PSH_Dimension dim = &glyph->globals->dimension[dimension];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
PSH2_Contour contour = glyph->contours;
|
||||
|
@ -1520,7 +1520,7 @@
|
|||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
for ( dimension = 1; dimension >= 0; dimension-- )
|
||||
for ( dimension = 0; dimension < 2; dimension++ )
|
||||
{
|
||||
/* load outline coordinates into glyph */
|
||||
psh2_glyph_load_points( glyph, dimension );
|
||||
|
|
|
@ -129,7 +129,9 @@ FT_BEGIN_HEADER
|
|||
} PSH_BluesRec, *PSH_Blues;
|
||||
|
||||
|
||||
/* font globals */
|
||||
/* font globals. */
|
||||
/* dimension 0 => X coordinates + vertical hints/stems */
|
||||
/* dimension 1 => Y coordinates + horizontal hints/stems */
|
||||
typedef struct PSH_GlobalsRec_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
|
|
@ -129,7 +129,9 @@ FT_BEGIN_HEADER
|
|||
#define PS_HINTS_MAGIC 0x68696e74 /* "hint" */
|
||||
|
||||
|
||||
/* glyph hints descriptor */
|
||||
/* glyph hints descriptor */
|
||||
/* dimension 0 => X coordinates + vertical hints/stems */
|
||||
/* dimension 1 => Y coordinates + horizontal hints/stems */
|
||||
typedef struct PS_HintsRec_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
|
Loading…
Reference in New Issue