[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] apodtele-master-patch-33657 8cbd4fcfe: [type1/MM] Round desi
From: |
Werner Lemberg |
Subject: |
[freetype2] apodtele-master-patch-33657 8cbd4fcfe: [type1/MM] Round design coordinates. |
Date: |
Thu, 9 Feb 2023 22:35:05 -0500 (EST) |
branch: apodtele-master-patch-33657
commit 8cbd4fcfe6c6f95778596e1b7a13250f49f9d12d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[type1/MM] Round design coordinates.
Contrary to FreeType documentation, the design coordinates for MM fonts
were not rounded. For example, `FT_Get_Var_Design_Coordinates` returned
numbers 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.
---
include/freetype/ftmm.h | 6 +++---
src/type1/t1load.c | 11 ++++++-----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h
index e381ef3d3..efe5dc7c1 100644
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -153,7 +153,7 @@ FT_BEGIN_HEADER
* @note:
* The fields `minimum`, `def`, and `maximum` are 16.16 fractional values
* for TrueType GX and OpenType variation fonts. For Adobe MM fonts, the
- * values are integers.
+ * values are whole numbers.
*/
typedef struct FT_Var_Axis_
{
@@ -400,7 +400,7 @@ FT_BEGIN_HEADER
* @note:
* The design coordinates are 16.16 fractional values for TrueType GX and
* OpenType variation fonts. For Adobe MM fonts, the values are
- * integers.
+ * supposed to be whole numbers.
*
* [Since 2.8.1] To reset all axes to the default values, call the
* function with `num_coords` set to zero and `coords` set to `NULL`.
@@ -447,7 +447,7 @@ FT_BEGIN_HEADER
* @note:
* The design coordinates are 16.16 fractional values for TrueType GX and
* OpenType variation fonts. For Adobe MM fonts, the values are
- * integers.
+ * whole numbers.
*
* @since:
* 2.7.1
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] );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] apodtele-master-patch-33657 8cbd4fcfe: [type1/MM] Round design coordinates.,
Werner Lemberg <=