|
|
|
@ -215,6 +215,85 @@ |
|
|
|
|
#define FT_FIXED_TO_INT( a ) ( FT_RoundFix( a ) >> 16 ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* Given a normalized (blend) coordinate, figure out the design */ |
|
|
|
|
/* coordinate appropriate for that value. */ |
|
|
|
|
/* */ |
|
|
|
|
FT_LOCAL_DEF( FT_Fixed ) |
|
|
|
|
mm_axis_unmap( PS_DesignMap axismap, |
|
|
|
|
FT_Fixed ncv ) |
|
|
|
|
{ |
|
|
|
|
int j; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( ncv <= axismap->blend_points[0] ) |
|
|
|
|
return axismap->design_points[0]; |
|
|
|
|
|
|
|
|
|
for ( j = 1; j < axismap->num_points; ++j ) |
|
|
|
|
{ |
|
|
|
|
if ( ncv <= axismap->blend_points[j] ) |
|
|
|
|
{ |
|
|
|
|
FT_Fixed t = FT_MulDiv( ncv - axismap->blend_points[j - 1], |
|
|
|
|
0x10000L, |
|
|
|
|
axismap->blend_points[j] - |
|
|
|
|
axismap->blend_points[j - 1] ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return axismap->design_points[j - 1] + |
|
|
|
|
FT_MulDiv( t, |
|
|
|
|
axismap->design_points[j] -
|
|
|
|
|
axismap->design_points[j - 1], |
|
|
|
|
1L ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return axismap->design_points[axismap->num_points - 1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* Given a vector of weights, one for each design, figure out the */ |
|
|
|
|
/* normalized axis coordinates which gave rise to those weights. */ |
|
|
|
|
/* */ |
|
|
|
|
FT_LOCAL_DEF( void ) |
|
|
|
|
mm_weights_unmap( FT_Fixed* weights, |
|
|
|
|
FT_Fixed* axiscoords, |
|
|
|
|
FT_UInt axis_count ) |
|
|
|
|
{ |
|
|
|
|
FT_ASSERT( axis_count <= T1_MAX_MM_AXIS ); |
|
|
|
|
|
|
|
|
|
if ( axis_count == 1 ) |
|
|
|
|
axiscoords[0] = weights[1]; |
|
|
|
|
|
|
|
|
|
else if ( axis_count == 2 ) |
|
|
|
|
{ |
|
|
|
|
axiscoords[0] = weights[3] + weights[1]; |
|
|
|
|
axiscoords[1] = weights[3] + weights[2]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if ( axis_count == 3 ) |
|
|
|
|
{ |
|
|
|
|
axiscoords[0] = weights[7] + weights[5] + weights[3] + weights[1]; |
|
|
|
|
axiscoords[1] = weights[7] + weights[6] + weights[3] + weights[2]; |
|
|
|
|
axiscoords[2] = weights[7] + weights[6] + weights[5] + weights[4]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
axiscoords[0] = weights[15] + weights[13] + weights[11] + weights[9] + |
|
|
|
|
weights[7] + weights[5] + weights[3] + weights[1]; |
|
|
|
|
axiscoords[1] = weights[15] + weights[14] + weights[11] + weights[10] + |
|
|
|
|
weights[7] + weights[6] + weights[3] + weights[2]; |
|
|
|
|
axiscoords[2] = weights[15] + weights[14] + weights[13] + weights[12] + |
|
|
|
|
weights[7] + weights[6] + weights[5] + weights[4]; |
|
|
|
|
axiscoords[3] = weights[15] + weights[14] + weights[13] + weights[12] + |
|
|
|
|
weights[11] + weights[10] + weights[9] + weights[8]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* Just a wrapper around T1_Get_Multi_Master to support the different */ |
|
|
|
@ -229,6 +308,8 @@ |
|
|
|
|
FT_Multi_Master mmaster; |
|
|
|
|
FT_Error error; |
|
|
|
|
FT_UInt i; |
|
|
|
|
FT_Fixed axiscoords[T1_MAX_MM_AXIS]; |
|
|
|
|
PS_Blend blend = face->blend; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error = T1_Get_Multi_Master( face, &mmaster ); |
|
|
|
@ -254,8 +335,26 @@ |
|
|
|
|
mmvar->axis[i].def = ( mmvar->axis[i].minimum + |
|
|
|
|
mmvar->axis[i].maximum ) / 2; |
|
|
|
|
/* Does not apply. But this value is in range */ |
|
|
|
|
mmvar->axis[i].tag = 0xFFFFFFFFLU; /* Does not apply */ |
|
|
|
|
mmvar->axis[i].strid = 0xFFFFFFFFLU; /* Does not apply */ |
|
|
|
|
mmvar->axis[i].tag = 0xFFFFFFFFLU; /* Does not apply */ |
|
|
|
|
|
|
|
|
|
if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 ) |
|
|
|
|
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' ); |
|
|
|
|
else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 ) |
|
|
|
|
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' ); |
|
|
|
|
else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 ) |
|
|
|
|
mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( blend->num_designs == 1U << blend->num_axis ) |
|
|
|
|
{ |
|
|
|
|
mm_weights_unmap( blend->default_weight_vector, |
|
|
|
|
axiscoords, |
|
|
|
|
blend->num_axis ); |
|
|
|
|
|
|
|
|
|
for ( i = 0; i < mmaster.num_axis; ++i ) |
|
|
|
|
mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i], |
|
|
|
|
axiscoords[i] ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*master = mmvar; |
|
|
|
@ -334,14 +433,14 @@ |
|
|
|
|
FT_Long design = coords[n]; |
|
|
|
|
FT_Fixed the_blend; |
|
|
|
|
PS_DesignMap map = blend->design_map + n; |
|
|
|
|
FT_Fixed* designs = map->design_points; |
|
|
|
|
FT_Long* designs = map->design_points; |
|
|
|
|
FT_Fixed* blends = map->blend_points; |
|
|
|
|
FT_Int before = -1, after = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( p = 0; p < (FT_UInt)map->num_points; p++ ) |
|
|
|
|
{ |
|
|
|
|
FT_Fixed p_design = designs[p]; |
|
|
|
|
FT_Long p_design = designs[p]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* exact match? */ |
|
|
|
|