freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][clean-gxvar] [truetype/GX] Clean up phantom poi


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][clean-gxvar] [truetype/GX] Clean up phantom point adjustment.
Date: Fri, 17 Jun 2022 12:24:17 +0000

Alexei Podtelezhnikov pushed to branch clean-gxvar at FreeType / FreeType

Commits:

  • aa160d66
    by Alexei Podtelezhnikov at 2022-06-17T08:23:12-04:00
    [truetype/GX] Clean up phantom point adjustment.
    
    * src/truetype/ttgload.c (load_truetype_glyph): Move it from here...
    * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here
    and check for HVAR and VVAR outside the loop.
    

2 changed files:

Changes:

  • src/truetype/ttgload.c
    ... ... @@ -1778,16 +1778,6 @@
    1778 1778
                                                 (FT_UInt)outline.n_points );
    
    1779 1779
             if ( error )
    
    1780 1780
               goto Exit;
    
    1781
    -
    
    1782
    -        loader->pp1.x = points[0].x;
    
    1783
    -        loader->pp1.y = points[0].y;
    
    1784
    -        loader->pp2.x = points[1].x;
    
    1785
    -        loader->pp2.y = points[1].y;
    
    1786
    -
    
    1787
    -        loader->pp3.x = points[2].x;
    
    1788
    -        loader->pp3.y = points[2].y;
    
    1789
    -        loader->pp4.x = points[3].x;
    
    1790
    -        loader->pp4.y = points[3].y;
    
    1791 1781
           }
    
    1792 1782
     
    
    1793 1783
     #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
    
    ... ... @@ -2008,16 +1998,6 @@
    2008 1998
               }
    
    2009 1999
             }
    
    2010 2000
     
    
    2011
    -        loader->pp1.x = points[i + 0].x;
    
    2012
    -        loader->pp1.y = points[i + 0].y;
    
    2013
    -        loader->pp2.x = points[i + 1].x;
    
    2014
    -        loader->pp2.y = points[i + 1].y;
    
    2015
    -
    
    2016
    -        loader->pp3.x = points[i + 2].x;
    
    2017
    -        loader->pp3.y = points[i + 2].y;
    
    2018
    -        loader->pp4.x = points[i + 3].x;
    
    2019
    -        loader->pp4.y = points[i + 3].y;
    
    2020
    -
    
    2021 2001
           Exit1:
    
    2022 2002
             FT_FREE( outline.points );
    
    2023 2003
             FT_FREE( outline.tags );
    

  • src/truetype/ttgxvar.c
    ... ... @@ -4075,36 +4075,8 @@
    4075 4075
               FT_Fixed  point_delta_y = FT_MulFix( deltas_y[j], apply );
    
    4076 4076
     
    
    4077 4077
     
    
    4078
    -          if ( j < n_points - 4 )
    
    4079
    -          {
    
    4080
    -            point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4081
    -            point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4082
    -          }
    
    4083
    -          else
    
    4084
    -          {
    
    4085
    -            /* To avoid double adjustment of advance width or height, */
    
    4086
    -            /* adjust phantom points only if there is no HVAR or VVAR */
    
    4087
    -            /* support, respectively.                                 */
    
    4088
    -            if ( j == ( n_points - 4 )        &&
    
    4089
    -                 !( face->variation_support &
    
    4090
    -                    TT_FACE_FLAG_VAR_LSB    ) )
    
    4091
    -              point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4092
    -
    
    4093
    -            else if ( j == ( n_points - 3 )          &&
    
    4094
    -                      !( face->variation_support   &
    
    4095
    -                         TT_FACE_FLAG_VAR_HADVANCE ) )
    
    4096
    -              point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4097
    -
    
    4098
    -            else if ( j == ( n_points - 2 )        &&
    
    4099
    -                      !( face->variation_support &
    
    4100
    -                         TT_FACE_FLAG_VAR_TSB    ) )
    
    4101
    -              point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4102
    -
    
    4103
    -            else if ( j == ( n_points - 1 )          &&
    
    4104
    -                      !( face->variation_support   &
    
    4105
    -                         TT_FACE_FLAG_VAR_VADVANCE ) )
    
    4106
    -              point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4107
    -          }
    
    4078
    +          point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4079
    +          point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4108 4080
     
    
    4109 4081
     #ifdef FT_DEBUG_LEVEL_TRACE
    
    4110 4082
               if ( point_delta_x || point_delta_y )
    
    ... ... @@ -4177,36 +4149,8 @@
    4177 4149
               FT_Pos  point_delta_y = points_out[j].y - points_org[j].y;
    
    4178 4150
     
    
    4179 4151
     
    
    4180
    -          if ( j < n_points - 4 )
    
    4181
    -          {
    
    4182
    -            point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4183
    -            point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4184
    -          }
    
    4185
    -          else
    
    4186
    -          {
    
    4187
    -            /* To avoid double adjustment of advance width or height, */
    
    4188
    -            /* adjust phantom points only if there is no HVAR or VVAR */
    
    4189
    -            /* support, respectively.                                 */
    
    4190
    -            if ( j == ( n_points - 4 )        &&
    
    4191
    -                 !( face->variation_support &
    
    4192
    -                    TT_FACE_FLAG_VAR_LSB    ) )
    
    4193
    -              point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4194
    -
    
    4195
    -            else if ( j == ( n_points - 3 )          &&
    
    4196
    -                      !( face->variation_support   &
    
    4197
    -                         TT_FACE_FLAG_VAR_HADVANCE ) )
    
    4198
    -              point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4199
    -
    
    4200
    -            else if ( j == ( n_points - 2 )        &&
    
    4201
    -                      !( face->variation_support &
    
    4202
    -                         TT_FACE_FLAG_VAR_TSB    ) )
    
    4203
    -              point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4204
    -
    
    4205
    -            else if ( j == ( n_points - 1 )          &&
    
    4206
    -                      !( face->variation_support   &
    
    4207
    -                         TT_FACE_FLAG_VAR_VADVANCE ) )
    
    4208
    -              point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4209
    -          }
    
    4152
    +          point_deltas_x[j] = old_point_delta_x + point_delta_x;
    
    4153
    +          point_deltas_y[j] = old_point_delta_y + point_delta_y;
    
    4210 4154
     
    
    4211 4155
     #ifdef FT_DEBUG_LEVEL_TRACE
    
    4212 4156
               if ( point_delta_x || point_delta_y )
    
    ... ... @@ -4253,14 +4197,25 @@
    4253 4197
           outline->points[i].y += FT_fixedToInt( point_deltas_y[i] );
    
    4254 4198
         }
    
    4255 4199
     
    
    4256
    -    /* recalculate linear horizontal and vertical advances */
    
    4257
    -    /* if we don't have HVAR and VVAR, respectively        */
    
    4200
    +    /* To avoid double adjustment of advance width or height, */
    
    4201
    +    /* adjust phantom points only if there is no HVAR or VVAR */
    
    4202
    +    /* support, respectively.                                 */
    
    4203
    +    if ( !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) )
    
    4204
    +      loader->pp1      = outline->points[n_points - 4];
    
    4258 4205
         if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
    
    4206
    +    {
    
    4207
    +      loader->pp2      = outline->points[n_points - 3];
    
    4259 4208
           loader->linear   = FT_PIX_ROUND( unrounded[n_points - 3].x -
    
    4260 4209
                                            unrounded[n_points - 4].x ) / 64;
    
    4210
    +    }
    
    4211
    +    if ( !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) )
    
    4212
    +      loader->pp3      = outline->points[n_points - 2];
    
    4261 4213
         if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
    
    4214
    +    {
    
    4215
    +      loader->pp4      = outline->points[n_points - 1];
    
    4262 4216
           loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].y -
    
    4263 4217
                                            unrounded[n_points - 2].y ) / 64;
    
    4218
    +    }
    
    4264 4219
     
    
    4265 4220
       Fail3:
    
    4266 4221
         FT_FREE( point_deltas_x );
    


  • reply via email to

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