summaryrefslogtreecommitdiff
path: root/src/type1/t1load.c
diff options
context:
space:
mode:
authorAlexei Podtelezhnikov <apodtele@gmail.com>2023-02-10 08:24:33 -0500
committerAlexei Podtelezhnikov <apodtele@gmail.com>2023-02-10 08:24:33 -0500
commitdacbb55433079fb3539163862958a6b9466a0661 (patch)
tree717a46027a6c0b29ce412a4c210feead6813b5c2 /src/type1/t1load.c
parent23e60caeef4027fdc9d1d40efbb47318a0a7d6f3 (diff)
downloadfreetype2-dacbb55433079fb3539163862958a6b9466a0661.tar.gz
[type1/MM] Round design coordinates.
The design coordinates for MM fonts were not rounded. For example, `FT_Get_Var_Design_Coordinates` returned values with fractional part. * src/type1/t1load.c (mm_axis_unmap): Refactor with rounding. * include/freetype/ftmm.h (FT_Var_Axis, FT_Set_Var_Design_Coordinates, FT_Get_Var_Design_Coordinates): Reword documentation.
Diffstat (limited to 'src/type1/t1load.c')
-rw-r--r--src/type1/t1load.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 5a1afd8d9..3ec9ffa16 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -225,11 +225,12 @@
for ( j = 1; j < axismap->num_points; j++ )
{
if ( ncv <= axismap->blend_points[j] )
- return INT_TO_FIXED( axismap->design_points[j - 1] ) +
- ( axismap->design_points[j] - axismap->design_points[j - 1] ) *
- FT_DivFix( ncv - axismap->blend_points[j - 1],
- axismap->blend_points[j] -
- axismap->blend_points[j - 1] );
+ return INT_TO_FIXED( axismap->design_points[j - 1] +
+ FT_MulDiv( ncv - axismap->blend_points[j - 1],
+ axismap->design_points[j] -
+ axismap->design_points[j - 1],
+ axismap->blend_points[j] -
+ axismap->blend_points[j - 1] ) );
}
return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );