freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 6 commits: [sfnt] Deltas for 'COLR' v1


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] 6 commits: [sfnt] Deltas for 'COLR' v1 gradient coordinates.
Date: Sat, 09 Jul 2022 04:00:29 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • 9c4ad2a9
    by Dominik Röttsches at 2022-07-09T05:41:27+02:00
    [sfnt] Deltas for 'COLR' v1 gradient coordinates.
    
    * src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and
    apply deltas to radial, linear, and sweep gradient coordinates such as 'p0',
    'p1', 'p2', 'center', 'radii', and 'angles'.
    
  • 8ec531c2
    by Dominik Röttsches at 2022-07-09T05:43:28+02:00
    [sfnt] Support for 'COLR' v1 variable transforms.
    
    * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`.
    (read_paint): Handle new enumeration value.
    
  • d134b9e3
    by Dominik Röttsches at 2022-07-09T05:44:58+02:00
    [sfnt] Support for 'COLR' v1 variable translate.
    
    * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`.
    (read_paint): Handle new enumeration value.
    
  • 603fef28
    by Dominik Röttsches at 2022-07-09T05:59:41+02:00
    [sfnt] Support 'COLR' v1 variable `PaintVarScale*`.
    
    * src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`,
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`,
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`.
    (read_paint): Handle new enumeration values.
    
  • 44fd524e
    by Dominik Röttsches at 2022-07-09T05:59:45+02:00
    [sfnt] Support variable 'COLR' v1 `PaintVarRotate*`.
    
    * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`.
    (read_paint): Handle new enumeration values.
    
  • 275b116b
    by Dominik Röttsches at 2022-07-09T05:59:45+02:00
    [sfnt] Support variable 'COLR' v1 `PaintVarSkew*`.
    
    * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`,
    `FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and
    `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`.
    (read_paint): Handle new enumeration values.
    

1 changed file:

Changes:

  • src/sfnt/ttcolr.c
    ... ... @@ -65,15 +65,25 @@
    65 65
     
    
    66 66
       typedef enum  FT_PaintFormat_Internal_
    
    67 67
       {
    
    68
    -    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID            = 3,
    
    69
    -    FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT  = 5,
    
    70
    -    FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT  = 7,
    
    71
    -    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT   = 9,
    
    72
    -    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER         = 18,
    
    73
    -    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM        = 20,
    
    74
    -    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER = 22,
    
    75
    -    FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER        = 26,
    
    76
    -    FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER          = 30
    
    68
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID                 = 3,
    
    69
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT       = 5,
    
    70
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT       = 7,
    
    71
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT        = 9,
    
    72
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM             = 13,
    
    73
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE             = 15,
    
    74
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE                 = 17,
    
    75
    +    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER              = 18,
    
    76
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER          = 19,
    
    77
    +    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM             = 20,
    
    78
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM         = 21,
    
    79
    +    FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER      = 22,
    
    80
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER  = 23,
    
    81
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE                = 25,
    
    82
    +    FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER             = 26,
    
    83
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER         = 27,
    
    84
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW                  = 29,
    
    85
    +    FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER               = 30,
    
    86
    +    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER           = 31,
    
    77 87
     
    
    78 88
       } FT_PaintFormat_Internal;
    
    79 89
     
    
    ... ... @@ -718,6 +728,24 @@
    718 728
           apaint->u.linear_gradient.p2.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    719 729
           apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    720 730
     
    
    731
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    732
    +      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    733
    +      {
    
    734
    +        var_index_base = FT_NEXT_ULONG ( p );
    
    735
    +
    
    736
    +        if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6,
    
    737
    +                                             item_deltas ) )
    
    738
    +          return 0;
    
    739
    +
    
    740
    +        apaint->u.linear_gradient.p0.x += INT_TO_FIXED( item_deltas[0] );
    
    741
    +        apaint->u.linear_gradient.p0.y += INT_TO_FIXED( item_deltas[1] );
    
    742
    +        apaint->u.linear_gradient.p1.x += INT_TO_FIXED( item_deltas[2] );
    
    743
    +        apaint->u.linear_gradient.p1.y += INT_TO_FIXED( item_deltas[3] );
    
    744
    +        apaint->u.linear_gradient.p2.x += INT_TO_FIXED( item_deltas[4] );
    
    745
    +        apaint->u.linear_gradient.p2.y += INT_TO_FIXED( item_deltas[5] );
    
    746
    +      }
    
    747
    +#endif
    
    748
    +
    
    721 749
           apaint->format = FT_COLR_PAINTFORMAT_LINEAR_GRADIENT;
    
    722 750
     
    
    723 751
           return 1;
    
    ... ... @@ -753,6 +781,28 @@
    753 781
           tmp                          = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    754 782
           apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp;
    
    755 783
     
    
    784
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    785
    +      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    786
    +      {
    
    787
    +        var_index_base = FT_NEXT_ULONG ( p );
    
    788
    +
    
    789
    +        if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6,
    
    790
    +                                             item_deltas ) )
    
    791
    +          return 0;
    
    792
    +
    
    793
    +        apaint->u.radial_gradient.c0.x += INT_TO_FIXED( item_deltas[0] );
    
    794
    +        apaint->u.radial_gradient.c0.y += INT_TO_FIXED( item_deltas[1] );
    
    795
    +
    
    796
    +        // TODO: Anything to be done about UFWORD deltas here?
    
    797
    +        apaint->u.radial_gradient.r0 += INT_TO_FIXED( item_deltas[2] );
    
    798
    +
    
    799
    +        apaint->u.radial_gradient.c1.x += INT_TO_FIXED( item_deltas[3] );
    
    800
    +        apaint->u.radial_gradient.c1.y += INT_TO_FIXED( item_deltas[4] );
    
    801
    +
    
    802
    +        apaint->u.radial_gradient.r1 += INT_TO_FIXED( item_deltas[5] );
    
    803
    +      }
    
    804
    +#endif
    
    805
    +
    
    756 806
           apaint->format = FT_COLR_PAINTFORMAT_RADIAL_GRADIENT;
    
    757 807
     
    
    758 808
           return 1;
    
    ... ... @@ -778,6 +828,25 @@
    778 828
           apaint->u.sweep_gradient.end_angle =
    
    779 829
               F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    780 830
     
    
    831
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    832
    +      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    833
    +      {
    
    834
    +        var_index_base = FT_NEXT_ULONG ( p );
    
    835
    +
    
    836
    +        if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4,
    
    837
    +                                             item_deltas ) )
    
    838
    +          return 0;
    
    839
    +
    
    840
    +        // TODO: Handle overflow?
    
    841
    +        apaint->u.sweep_gradient.center.x += INT_TO_FIXED( item_deltas[0] );
    
    842
    +        apaint->u.sweep_gradient.center.y += INT_TO_FIXED( item_deltas[1] );
    
    843
    +
    
    844
    +        apaint->u.sweep_gradient.start_angle +=
    
    845
    +          F2DOT14_TO_FIXED( item_deltas[2] );
    
    846
    +        apaint->u.sweep_gradient.end_angle +=
    
    847
    +          F2DOT14_TO_FIXED( item_deltas[3] );
    
    848
    +      }
    
    849
    +#endif
    
    781 850
           apaint->format = FT_COLR_PAINTFORMAT_SWEEP_GRADIENT;
    
    782 851
     
    
    783 852
           return 1;
    
    ... ... @@ -792,7 +861,9 @@
    792 861
           return 1;
    
    793 862
         }
    
    794 863
     
    
    795
    -    else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORM )
    
    864
    +    else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORM ||
    
    865
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    866
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM    )
    
    796 867
         {
    
    797 868
           apaint->u.transform.paint.p                     = child_table_p;
    
    798 869
           apaint->u.transform.paint.insert_root_transform = 0;
    
    ... ... @@ -813,10 +884,34 @@
    813 884
           apaint->u.transform.affine.dx = FT_NEXT_LONG( p );
    
    814 885
           apaint->u.transform.affine.dy = FT_NEXT_LONG( p );
    
    815 886
     
    
    887
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    888
    +      if ( (FT_PaintFormat_Internal)apaint->format ==
    
    889
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM &&
    
    890
    +           VARIABLE_COLRV1_ENABLED                      )
    
    891
    +      {
    
    892
    +        var_index_base = FT_NEXT_ULONG( p );
    
    893
    +
    
    894
    +        if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 6,
    
    895
    +                                             item_deltas ) )
    
    896
    +          return 0;
    
    897
    +
    
    898
    +        apaint->u.transform.affine.xx += (FT_Fixed)item_deltas[0];
    
    899
    +        apaint->u.transform.affine.yx += (FT_Fixed)item_deltas[1];
    
    900
    +        apaint->u.transform.affine.xy += (FT_Fixed)item_deltas[2];
    
    901
    +        apaint->u.transform.affine.yy += (FT_Fixed)item_deltas[3];
    
    902
    +        apaint->u.transform.affine.dx += (FT_Fixed)item_deltas[4];
    
    903
    +        apaint->u.transform.affine.dy += (FT_Fixed)item_deltas[5];
    
    904
    +      }
    
    905
    +#endif
    
    906
    +
    
    907
    +      apaint->format = FT_COLR_PAINTFORMAT_TRANSFORM;
    
    908
    +
    
    816 909
           return 1;
    
    817 910
         }
    
    818 911
     
    
    819
    -    else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE )
    
    912
    +    else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE ||
    
    913
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    914
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE    )
    
    820 915
         {
    
    821 916
           apaint->u.translate.paint.p                     = child_table_p;
    
    822 917
           apaint->u.translate.paint.insert_root_transform = 0;
    
    ... ... @@ -824,17 +919,30 @@
    824 919
           apaint->u.translate.dx = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    825 920
           apaint->u.translate.dy = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    826 921
     
    
    922
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    923
    +      if ( (FT_PaintFormat_Internal)apaint->format ==
    
    924
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE &&
    
    925
    +           VARIABLE_COLRV1_ENABLED                      )
    
    926
    +      {
    
    927
    +        var_index_base = FT_NEXT_ULONG( p );
    
    928
    +
    
    929
    +        if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2,
    
    930
    +                                             item_deltas ) )
    
    931
    +          return 0;
    
    932
    +
    
    933
    +        apaint->u.translate.dx += INT_TO_FIXED( item_deltas[0] );
    
    934
    +        apaint->u.translate.dy += INT_TO_FIXED( item_deltas[1] );
    
    935
    +      }
    
    936
    +#endif
    
    937
    +
    
    938
    +      apaint->format = FT_COLR_PAINTFORMAT_TRANSLATE;
    
    939
    +
    
    827 940
           return 1;
    
    828 941
         }
    
    829 942
     
    
    830
    -    else if ( apaint->format ==
    
    831
    -                FT_COLR_PAINTFORMAT_SCALE                         ||
    
    832
    -              (FT_PaintFormat_Internal)apaint->format ==
    
    833
    -                FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER         ||
    
    834
    -              (FT_PaintFormat_Internal)apaint->format ==
    
    835
    -                FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM        ||
    
    836
    -              (FT_PaintFormat_Internal)apaint->format ==
    
    837
    -                FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER )
    
    943
    +    else if ( apaint->format >= FT_COLR_PAINTFORMAT_SCALE             &&
    
    944
    +              (FT_PaintFormat_Internal)apaint->format <=
    
    945
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER )
    
    838 946
         {
    
    839 947
           apaint->u.scale.paint.p                     = child_table_p;
    
    840 948
           apaint->u.scale.paint.insert_root_transform = 0;
    
    ... ... @@ -843,10 +951,13 @@
    843 951
           apaint->u.scale.scale_x = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    844 952
     
    
    845 953
           /* Non-uniform ones read an extra y value. */
    
    846
    -      if ( apaint->format ==
    
    847
    -             FT_COLR_PAINTFORMAT_SCALE                 ||
    
    954
    +      if ( apaint->format == FT_COLR_PAINTFORMAT_SCALE     ||
    
    955
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    956
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE        ||
    
    957
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    958
    +             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER     ||
    
    848 959
                (FT_PaintFormat_Internal)apaint->format ==
    
    849
    -             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER )
    
    960
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER )
    
    850 961
             apaint->u.scale.scale_y = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    851 962
           else
    
    852 963
             apaint->u.scale.scale_y = apaint->u.scale.scale_x;
    
    ... ... @@ -854,9 +965,13 @@
    854 965
           /* Scale paints that have a center read center coordinates, */
    
    855 966
           /* otherwise the center is (0,0).                           */
    
    856 967
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    857
    -             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER         ||
    
    968
    +             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER             ||
    
    858 969
                (FT_PaintFormat_Internal)apaint->format ==
    
    859
    -             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER )
    
    970
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER         ||
    
    971
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    972
    +             FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER     ||
    
    973
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    974
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER )
    
    860 975
           {
    
    861 976
             apaint->u.scale.center_x = INT_TO_FIXED( FT_NEXT_SHORT ( p ) );
    
    862 977
             apaint->u.scale.center_y = INT_TO_FIXED( FT_NEXT_SHORT ( p ) );
    
    ... ... @@ -867,6 +982,71 @@
    867 982
             apaint->u.scale.center_y = 0;
    
    868 983
           }
    
    869 984
     
    
    985
    +      /* Base values set, now handle variations. */
    
    986
    +
    
    987
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    988
    +      if ( ( (FT_PaintFormat_Internal)apaint->format ==
    
    989
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE                ||
    
    990
    +             (FT_PaintFormat_Internal)apaint->format ==
    
    991
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER         ||
    
    992
    +             (FT_PaintFormat_Internal)apaint->format ==
    
    993
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM        ||
    
    994
    +             (FT_PaintFormat_Internal)apaint->format ==
    
    995
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) &&
    
    996
    +           VARIABLE_COLRV1_ENABLED                                     )
    
    997
    +      {
    
    998
    +        var_index_base = FT_NEXT_ULONG( p );
    
    999
    +
    
    1000
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1001
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE )
    
    1002
    +        {
    
    1003
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2,
    
    1004
    +                                               item_deltas ) )
    
    1005
    +            return 0;
    
    1006
    +
    
    1007
    +          apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1008
    +          apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[1] );
    
    1009
    +        }
    
    1010
    +
    
    1011
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1012
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER )
    
    1013
    +        {
    
    1014
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4,
    
    1015
    +                                               item_deltas ) )
    
    1016
    +            return 0;
    
    1017
    +
    
    1018
    +          apaint->u.scale.scale_x  += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1019
    +          apaint->u.scale.scale_y  += F2DOT14_TO_FIXED( item_deltas[1] );
    
    1020
    +          apaint->u.scale.center_x += INT_TO_FIXED( item_deltas[2] );
    
    1021
    +          apaint->u.scale.center_y += INT_TO_FIXED( item_deltas[3] );
    
    1022
    +        }
    
    1023
    +
    
    1024
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1025
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM )
    
    1026
    +        {
    
    1027
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 1,
    
    1028
    +                                               item_deltas ) )
    
    1029
    +            return 0;
    
    1030
    +
    
    1031
    +          apaint->u.scale.scale_x += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1032
    +          apaint->u.scale.scale_y += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1033
    +        }
    
    1034
    +
    
    1035
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1036
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER )
    
    1037
    +        {
    
    1038
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 3,
    
    1039
    +                                               item_deltas ) )
    
    1040
    +            return 0;
    
    1041
    +
    
    1042
    +          apaint->u.scale.scale_x  += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1043
    +          apaint->u.scale.scale_y  += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1044
    +          apaint->u.scale.center_x += INT_TO_FIXED( item_deltas[1] );
    
    1045
    +          apaint->u.scale.center_y += INT_TO_FIXED( item_deltas[2] );
    
    1046
    +        }
    
    1047
    +      }
    
    1048
    +#endif
    
    1049
    +
    
    870 1050
           /* FT 'COLR' v1 API output format always returns fully defined */
    
    871 1051
           /* structs; we thus set the format to the public API value.    */
    
    872 1052
           apaint->format = FT_COLR_PAINTFORMAT_SCALE;
    
    ... ... @@ -874,17 +1054,26 @@
    874 1054
           return 1;
    
    875 1055
         }
    
    876 1056
     
    
    877
    -    else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE ||
    
    1057
    +    else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE     ||
    
    878 1058
                   (FT_PaintFormat_Internal)apaint->format ==
    
    879
    -                FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER )
    
    1059
    +                FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER     ||
    
    1060
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    1061
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE        ||
    
    1062
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    1063
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
    
    880 1064
         {
    
    1065
    +      FT_UInt  num_deltas = 0;
    
    1066
    +
    
    1067
    +
    
    881 1068
           apaint->u.rotate.paint.p                     = child_table_p;
    
    882 1069
           apaint->u.rotate.paint.insert_root_transform = 0;
    
    883 1070
     
    
    884 1071
           apaint->u.rotate.angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    885 1072
     
    
    886 1073
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    887
    -           FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER )
    
    1074
    +             FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER     ||
    
    1075
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    1076
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
    
    888 1077
           {
    
    889 1078
             apaint->u.rotate.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    890 1079
             apaint->u.rotate.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    ... ... @@ -895,14 +1084,52 @@
    895 1084
             apaint->u.rotate.center_y = 0;
    
    896 1085
           }
    
    897 1086
     
    
    1087
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1088
    +      if ( ( (FT_PaintFormat_Internal)apaint->format ==
    
    1089
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE        ||
    
    1090
    +             (FT_PaintFormat_Internal)apaint->format ==
    
    1091
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
    
    1092
    +           VARIABLE_COLRV1_ENABLED                              )
    
    1093
    +      {
    
    1094
    +        var_index_base = FT_NEXT_ULONG( p );
    
    1095
    +
    
    1096
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1097
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
    
    1098
    +          num_deltas = 3;
    
    1099
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1100
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE )
    
    1101
    +          num_deltas = 1;
    
    1102
    +
    
    1103
    +        if ( num_deltas > 0 )
    
    1104
    +        {
    
    1105
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base,
    
    1106
    +                                               num_deltas, item_deltas ) )
    
    1107
    +            return 0;
    
    1108
    +
    
    1109
    +          apaint->u.rotate.angle += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1110
    +
    
    1111
    +          if ( num_deltas == 3 )
    
    1112
    +          {
    
    1113
    +            apaint->u.rotate.center_x += INT_TO_FIXED( item_deltas[1] );
    
    1114
    +            apaint->u.rotate.center_y += INT_TO_FIXED( item_deltas[2] );
    
    1115
    +          }
    
    1116
    +        }
    
    1117
    +      }
    
    1118
    +#endif
    
    1119
    +
    
    898 1120
           apaint->format = FT_COLR_PAINTFORMAT_ROTATE;
    
    899 1121
     
    
    1122
    +
    
    900 1123
           return 1;
    
    901 1124
         }
    
    902 1125
     
    
    903
    -    else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW ||
    
    1126
    +    else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW     ||
    
    1127
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    1128
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW        ||
    
    1129
    +              (FT_PaintFormat_Internal)apaint->format ==
    
    1130
    +                FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER     ||
    
    904 1131
                   (FT_PaintFormat_Internal)apaint->format ==
    
    905
    -                FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER )
    
    1132
    +                FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER )
    
    906 1133
         {
    
    907 1134
           apaint->u.skew.paint.p                     = child_table_p;
    
    908 1135
           apaint->u.skew.paint.insert_root_transform = 0;
    
    ... ... @@ -911,7 +1138,9 @@
    911 1138
           apaint->u.skew.y_skew_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    912 1139
     
    
    913 1140
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    914
    -           FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER )
    
    1141
    +             FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER     ||
    
    1142
    +           (FT_PaintFormat_Internal)apaint->format ==
    
    1143
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER )
    
    915 1144
           {
    
    916 1145
             apaint->u.skew.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    917 1146
             apaint->u.skew.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    ... ... @@ -922,6 +1151,42 @@
    922 1151
             apaint->u.skew.center_y = 0;
    
    923 1152
           }
    
    924 1153
     
    
    1154
    +
    
    1155
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1156
    +      if ( ( (FT_PaintFormat_Internal)apaint->format ==
    
    1157
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW        ||
    
    1158
    +             (FT_PaintFormat_Internal)apaint->format ==
    
    1159
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) &&
    
    1160
    +           VARIABLE_COLRV1_ENABLED                            )
    
    1161
    +      {
    
    1162
    +        var_index_base = FT_NEXT_ULONG( p );
    
    1163
    +
    
    1164
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1165
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW )
    
    1166
    +        {
    
    1167
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 2,
    
    1168
    +                                               item_deltas ) )
    
    1169
    +            return 0;
    
    1170
    +
    
    1171
    +          apaint->u.skew.x_skew_angle += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1172
    +          apaint->u.skew.y_skew_angle += F2DOT14_TO_FIXED( item_deltas[1] );
    
    1173
    +        }
    
    1174
    +
    
    1175
    +        if ( (FT_PaintFormat_Internal)apaint->format ==
    
    1176
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER )
    
    1177
    +        {
    
    1178
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4,
    
    1179
    +                                               item_deltas ) )
    
    1180
    +            return 0;
    
    1181
    +
    
    1182
    +          apaint->u.skew.x_skew_angle += F2DOT14_TO_FIXED( item_deltas[0] );
    
    1183
    +          apaint->u.skew.y_skew_angle += F2DOT14_TO_FIXED( item_deltas[1] );
    
    1184
    +          apaint->u.skew.center_x     += INT_TO_FIXED( item_deltas[2] );
    
    1185
    +          apaint->u.skew.center_y     += INT_TO_FIXED( item_deltas[3] );
    
    1186
    +        }
    
    1187
    +      }
    
    1188
    +#endif
    
    1189
    +
    
    925 1190
           apaint->format = FT_COLR_PAINTFORMAT_SKEW;
    
    926 1191
     
    
    927 1192
           return 1;
    


  • reply via email to

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