freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][apodtele-master-patch-33657] [type1/MM] Round d


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][apodtele-master-patch-33657] [type1/MM] Round design coordinates.
Date: Fri, 10 Feb 2023 13:27:28 +0000

Alexei Podtelezhnikov pushed to branch apodtele-master-patch-33657 at FreeType / FreeType

Commits:

  • dacbb554
    by Alexei Podtelezhnikov at 2023-02-10T08:24:33-05:00
    [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.
    

2 changed files:

Changes:

  • include/freetype/ftmm.h
    ... ... @@ -153,7 +153,7 @@ FT_BEGIN_HEADER
    153 153
        * @note:
    
    154 154
        *   The fields `minimum`, `def`, and `maximum` are 16.16 fractional values
    
    155 155
        *   for TrueType GX and OpenType variation fonts.  For Adobe MM fonts, the
    
    156
    -   *   values are integers.
    
    156
    +   *   values are whole numbers (i.e., the fractional part is zero).
    
    157 157
        */
    
    158 158
       typedef struct  FT_Var_Axis_
    
    159 159
       {
    
    ... ... @@ -399,8 +399,8 @@ FT_BEGIN_HEADER
    399 399
        *
    
    400 400
        * @note:
    
    401 401
        *   The design coordinates are 16.16 fractional values for TrueType GX and
    
    402
    -   *   OpenType variation fonts.  For Adobe MM fonts, the values are
    
    403
    -   *   integers.
    
    402
    +   *   OpenType variation fonts.  For Adobe MM fonts, the values are supposed
    
    403
    +   *   to be whole numbers (i.e., the fractional part is zero).
    
    404 404
        *
    
    405 405
        *   [Since 2.8.1] To reset all axes to the default values, call the
    
    406 406
        *   function with `num_coords` set to zero and `coords` set to `NULL`.
    
    ... ... @@ -446,8 +446,8 @@ FT_BEGIN_HEADER
    446 446
        *
    
    447 447
        * @note:
    
    448 448
        *   The design coordinates are 16.16 fractional values for TrueType GX and
    
    449
    -   *   OpenType variation fonts.  For Adobe MM fonts, the values are
    
    450
    -   *   integers.
    
    449
    +   *   OpenType variation fonts.  For Adobe MM fonts, the values are whole
    
    450
    +   *   numbers (i.e., the fractional part is zero).
    
    451 451
        *
    
    452 452
        * @since:
    
    453 453
        *   2.7.1
    

  • src/type1/t1load.c
    ... ... @@ -225,11 +225,12 @@
    225 225
         for ( j = 1; j < axismap->num_points; j++ )
    
    226 226
         {
    
    227 227
           if ( ncv <= axismap->blend_points[j] )
    
    228
    -        return INT_TO_FIXED( axismap->design_points[j - 1] ) +
    
    229
    -               ( axismap->design_points[j] - axismap->design_points[j - 1] ) *
    
    230
    -               FT_DivFix( ncv - axismap->blend_points[j - 1],
    
    231
    -                          axismap->blend_points[j] -
    
    232
    -                            axismap->blend_points[j - 1] );
    
    228
    +        return INT_TO_FIXED( axismap->design_points[j - 1] +
    
    229
    +                               FT_MulDiv( ncv - axismap->blend_points[j - 1],
    
    230
    +                                          axismap->design_points[j] -
    
    231
    +                                            axismap->design_points[j - 1],
    
    232
    +                                          axismap->blend_points[j] -
    
    233
    +                                            axismap->blend_points[j - 1] ) );
    
    233 234
         }
    
    234 235
     
    
    235 236
         return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]