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 advance adj


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][clean-gxvar] [truetype/GX] Clean up advance adjustment.
Date: Wed, 15 Jun 2022 22:30:19 +0000

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

Commits:

  • d6fc8c6b
    by Alexei Podtelezhnikov at 2022-06-15T18:28:50-04:00
    [truetype/GX] Clean up advance adjustment.
    
    * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph):
    Move the advance adjustment from here...
    * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here and
    simplify arguments.
    * src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Update prototype
    with fewer arguments.
    

3 changed files:

Changes:

  • src/truetype/ttgload.c
    ... ... @@ -985,24 +985,10 @@
    985 985
             goto Exit;
    
    986 986
     
    
    987 987
           /* Deltas apply to the unscaled data. */
    
    988
    -      error = TT_Vary_Apply_Glyph_Deltas( loader->face,
    
    989
    -                                          loader->glyph_index,
    
    988
    +      error = TT_Vary_Apply_Glyph_Deltas( loader,
    
    990 989
                                               outline,
    
    991 990
                                               unrounded,
    
    992 991
                                               (FT_UInt)n_points );
    
    993
    -
    
    994
    -      /* recalculate linear horizontal and vertical advances */
    
    995
    -      /* if we don't have HVAR and VVAR, respectively        */
    
    996
    -
    
    997
    -      /* XXX: change all FreeType modules to store `linear' and `vadvance' */
    
    998
    -      /*      in 26.6 format before the `base' module scales them to 16.16 */
    
    999
    -      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
    
    1000
    -        loader->linear = FT_PIX_ROUND( unrounded[n_points - 3].x -
    
    1001
    -                                       unrounded[n_points - 4].x ) / 64;
    
    1002
    -      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
    
    1003
    -        loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].x -
    
    1004
    -                                         unrounded[n_points - 2].x ) / 64;
    
    1005
    -
    
    1006 992
           if ( error )
    
    1007 993
             goto Exit;
    
    1008 994
         }
    
    ... ... @@ -1786,8 +1772,7 @@
    1786 1772
             outline.contours   = contours;
    
    1787 1773
     
    
    1788 1774
             /* this must be done before scaling */
    
    1789
    -        error = TT_Vary_Apply_Glyph_Deltas( loader->face,
    
    1790
    -                                            glyph_index,
    
    1775
    +        error = TT_Vary_Apply_Glyph_Deltas( loader,
    
    1791 1776
                                                 &outline,
    
    1792 1777
                                                 unrounded,
    
    1793 1778
                                                 (FT_UInt)outline.n_points );
    
    ... ... @@ -1803,15 +1788,6 @@
    1803 1788
             loader->pp3.y = points[2].y;
    
    1804 1789
             loader->pp4.x = points[3].x;
    
    1805 1790
             loader->pp4.y = points[3].y;
    
    1806
    -
    
    1807
    -        /* recalculate linear horizontal and vertical advances */
    
    1808
    -        /* if we don't have HVAR and VVAR, respectively        */
    
    1809
    -        if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
    
    1810
    -          loader->linear = FT_PIX_ROUND( unrounded[1].x -
    
    1811
    -                                         unrounded[0].x ) / 64;
    
    1812
    -        if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
    
    1813
    -          loader->vadvance = FT_PIX_ROUND( unrounded[3].x -
    
    1814
    -                                           unrounded[2].x ) / 64;
    
    1815 1791
           }
    
    1816 1792
     
    
    1817 1793
     #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
    
    ... ... @@ -2015,8 +1991,7 @@
    2015 1991
             /* this call provides additional offsets */
    
    2016 1992
             /* for each component's translation      */
    
    2017 1993
             if ( FT_SET_ERROR( TT_Vary_Apply_Glyph_Deltas(
    
    2018
    -                             face,
    
    2019
    -                             glyph_index,
    
    1994
    +                             loader,
    
    2020 1995
                                  &outline,
    
    2021 1996
                                  unrounded,
    
    2022 1997
                                  (FT_UInt)outline.n_points ) ) )
    

  • src/truetype/ttgxvar.c
    ... ... @@ -3827,39 +3827,37 @@
    3827 3827
        * @Description:
    
    3828 3828
        *   Apply the appropriate deltas to the current glyph.
    
    3829 3829
        *
    
    3830
    -   * @Input:
    
    3831
    -   *   face ::
    
    3832
    -   *     A handle to the target face object.
    
    3833
    -   *
    
    3834
    -   *   glyph_index ::
    
    3835
    -   *     The index of the glyph being modified.
    
    3836
    -   *
    
    3837
    -   *   n_points ::
    
    3838
    -   *     The number of the points in the glyph, including
    
    3839
    -   *     phantom points.
    
    3840
    -   *
    
    3841 3830
        * @InOut:
    
    3831
    +   *   loader ::
    
    3832
    +   *     A handle to the loader object.
    
    3833
    +   *
    
    3842 3834
        *   outline ::
    
    3843
    -   *     The outline to change.
    
    3835
    +   *     The outline to change, with appended phantom points.
    
    3844 3836
        *
    
    3845 3837
        * @Output:
    
    3846 3838
        *   unrounded ::
    
    3847 3839
        *     An array with `n_points' elements that is filled with unrounded
    
    3848 3840
        *     point coordinates (in 26.6 format).
    
    3849 3841
        *
    
    3842
    +   * @Input
    
    3843
    +   *   n_points ::
    
    3844
    +   *     The number of the points in the glyph, including
    
    3845
    +   *     phantom points.
    
    3846
    +   *
    
    3850 3847
        * @Return:
    
    3851 3848
        *   FreeType error code.  0 means success.
    
    3852 3849
        */
    
    3853 3850
       FT_LOCAL_DEF( FT_Error )
    
    3854
    -  TT_Vary_Apply_Glyph_Deltas( TT_Face      face,
    
    3855
    -                              FT_UInt      glyph_index,
    
    3851
    +  TT_Vary_Apply_Glyph_Deltas( TT_Loader    loader,
    
    3856 3852
                                   FT_Outline*  outline,
    
    3857 3853
                                   FT_Vector*   unrounded,
    
    3858 3854
                                   FT_UInt      n_points )
    
    3859 3855
       {
    
    3860 3856
         FT_Error   error;
    
    3857
    +    TT_Face    face = loader->face;
    
    3861 3858
         FT_Stream  stream = face->root.stream;
    
    3862 3859
         FT_Memory  memory = stream->memory;
    
    3860
    +    FT_UInt    glyph_index = loader->glyph_index;
    
    3863 3861
     
    
    3864 3862
         FT_Vector*  points_org = NULL;  /* coordinates in 16.16 format */
    
    3865 3863
         FT_Vector*  points_out = NULL;  /* coordinates in 16.16 format */
    
    ... ... @@ -4255,6 +4253,15 @@
    4255 4253
           outline->points[i].y += FT_fixedToInt( point_deltas_y[i] );
    
    4256 4254
         }
    
    4257 4255
     
    
    4256
    +    /* recalculate linear horizontal and vertical advances */
    
    4257
    +    /* if we don't have HVAR and VVAR, respectively        */
    
    4258
    +    if ( !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
    
    4259
    +      loader->linear   = FT_PIX_ROUND( unrounded[n_points - 3].x -
    
    4260
    +                                       unrounded[n_points - 4].x ) / 64;
    
    4261
    +    if ( !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
    
    4262
    +      loader->vadvance = FT_PIX_ROUND( unrounded[n_points - 1].x -
    
    4263
    +                                       unrounded[n_points - 2].x ) / 64;
    
    4264
    +
    
    4258 4265
       Fail3:
    
    4259 4266
         FT_FREE( point_deltas_x );
    
    4260 4267
         FT_FREE( point_deltas_y );
    

  • src/truetype/ttgxvar.h
    ... ... @@ -361,8 +361,7 @@ FT_BEGIN_HEADER
    361 361
     
    
    362 362
     
    
    363 363
       FT_LOCAL( FT_Error )
    
    364
    -  TT_Vary_Apply_Glyph_Deltas( TT_Face      face,
    
    365
    -                              FT_UInt      glyph_index,
    
    364
    +  TT_Vary_Apply_Glyph_Deltas( TT_Loader    loader,
    
    366 365
                                   FT_Outline*  outline,
    
    367 366
                                   FT_Vector*   unrounded,
    
    368 367
                                   FT_UInt      n_points );
    


  • reply via email to

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