freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 215ae25 56/68: [sfnt] Update paint format values to s


From: Werner Lemberg
Subject: [freetype2] master 215ae25 56/68: [sfnt] Update paint format values to support non-variable paints.
Date: Fri, 5 Mar 2021 09:29:43 -0500 (EST)

branch: master
commit 215ae253304d610b90778d438abc1d019699ebd8
Author: Dominik Röttsches <drott@chromium.org>
Commit: Werner Lemberg <wl@gnu.org>

    [sfnt] Update paint format values to support non-variable paints.
    
    * freetype.h (FT_PaintFormat): Update paint format identifiers after
    a specification change.  The specification was updated to have
    sibling formats, variable and non-variable variants for each.
    Reflect that here.
    
    * sfnt/ttcolr.c (read_paint): Remove parsing of variable indices as
    the non-variable formats no longer have them.
---
 ChangeLog                   | 12 ++++++++++++
 include/freetype/freetype.h | 31 +++++++++++++++++++------------
 src/sfnt/ttcolr.c           | 43 -------------------------------------------
 3 files changed, 31 insertions(+), 55 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ef0fe4b..876d820 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2021-02-16  Dominik Röttsches  <drott@chromium.org>
+
+       [sfnt] Update paint format values to support non-variable paints.
+
+       * freetype.h (FT_PaintFormat): Update paint format identifiers after
+       a specification change.  The specification was updated to have
+       sibling formats, variable and non-variable variants for each.
+       Reflect that here.
+
+       * sfnt/ttcolr.c (read_paint): Remove parsing of variable indices as
+       the non-variable formats no longer have them.
+
 2021-02-15  Daniel E  <daniel.engberg.lists@pyret.net>
 
        * CMakeLists.txt: Improve 'bz2' support.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 6c6b298..0e870b3 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -4256,25 +4256,32 @@ FT_BEGIN_HEADER
    *   FT_PaintFormat
    *
    * @description:
-   *   Enumeration describing the different gradient types of the v1
+   *   Enumeration describing the different paint format types of the v1
    *   extensions to the 'COLR' table, see
    *   'https://github.com/googlefonts/colr-gradients-spec'.
+   *
+   *   Only non-variable format identifiers are listed in this enumeration;
+   *   as soon as support for variable 'COLR' v1 fonts is implemented,
+   *   interpolation is performed dependent on axis coordinates, which are
+   *   configured on the @FT_Face through @FT_Set_Var_Design_Coordinates.
+   *   This implies that always static (interpolated) values are returned
+   *   for both variable and non-variable formats.
    */
   typedef enum  FT_PaintFormat_
   {
     FT_COLR_PAINTFORMAT_COLR_LAYERS     = 1,
     FT_COLR_PAINTFORMAT_SOLID           = 2,
-    FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 3,
-    FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 4,
-    FT_COLR_PAINTFORMAT_SWEEP_GRADIENT  = 5,
-    FT_COLR_PAINTFORMAT_GLYPH           = 6,
-    FT_COLR_PAINTFORMAT_COLR_GLYPH      = 7,
-    FT_COLR_PAINTFORMAT_TRANSFORMED     = 8,
-    FT_COLR_PAINTFORMAT_TRANSLATE       = 9,
-    FT_COLR_PAINTFORMAT_ROTATE          = 10,
-    FT_COLR_PAINTFORMAT_SKEW            = 11,
-    FT_COLR_PAINTFORMAT_COMPOSITE       = 12,
-    FT_COLR_PAINT_FORMAT_MAX            = 13,
+    FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 4,
+    FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 6,
+    FT_COLR_PAINTFORMAT_SWEEP_GRADIENT  = 8,
+    FT_COLR_PAINTFORMAT_GLYPH           = 10,
+    FT_COLR_PAINTFORMAT_COLR_GLYPH      = 11,
+    FT_COLR_PAINTFORMAT_TRANSFORMED     = 12,
+    FT_COLR_PAINTFORMAT_TRANSLATE       = 14,
+    FT_COLR_PAINTFORMAT_ROTATE          = 16,
+    FT_COLR_PAINTFORMAT_SKEW            = 18,
+    FT_COLR_PAINTFORMAT_COMPOSITE       = 20,
+    FT_COLR_PAINT_FORMAT_MAX            = 21,
     FT_COLR_PAINTFORMAT_UNSUPPORTED     = 255
 
   } FT_PaintFormat;
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index b90e35b..1430cfc 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -405,8 +405,6 @@
     {
       apaint->u.solid.color.palette_index = FT_NEXT_USHORT ( p );
       apaint->u.solid.color.alpha         = FT_NEXT_USHORT ( p );
-      /* skip VarIdx */
-      FT_NEXT_ULONG ( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_LINEAR_GRADIENT )
@@ -419,19 +417,12 @@
                              &apaint->u.linear_gradient.colorline ) )
         return 0;
 
-      /* skip VarIdx entries */
       apaint->u.linear_gradient.p0.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.linear_gradient.p0.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.linear_gradient.p1.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.linear_gradient.p1.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.linear_gradient.p2.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.linear_gradient.p2.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT )
@@ -444,22 +435,15 @@
                              &apaint->u.radial_gradient.colorline ) )
         return 0;
 
-      /* skip VarIdx entries */
       apaint->u.radial_gradient.c0.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.radial_gradient.c0.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
 
       apaint->u.radial_gradient.r0 = FT_NEXT_USHORT ( p );
-      FT_NEXT_ULONG ( p );
 
       apaint->u.radial_gradient.c1.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.radial_gradient.c1.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
 
       apaint->u.radial_gradient.r1 = FT_NEXT_USHORT ( p );
-      FT_NEXT_ULONG ( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_SWEEP_GRADIENT )
@@ -472,16 +456,11 @@
                              &apaint->u.sweep_gradient.colorline ) )
         return 0;
 
-      /* skip VarIdx entries */
       apaint->u.sweep_gradient.center.x = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.sweep_gradient.center.y = FT_NEXT_SHORT ( p );
-      FT_NEXT_ULONG ( p );
 
       apaint->u.sweep_gradient.start_angle = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG ( p );
       apaint->u.sweep_gradient.end_angle = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG ( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSFORMED )
@@ -501,19 +480,12 @@
       apaint->u.transformed.paint.p                     = paint_p;
       apaint->u.transformed.paint.insert_root_transform = 0;
 
-      /* skip VarIdx entries */
       apaint->u.transformed.affine.xx = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.transformed.affine.yx = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.transformed.affine.xy = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.transformed.affine.yy = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.transformed.affine.dx = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.transformed.affine.dy = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_TRANSLATE )
@@ -533,11 +505,8 @@
       apaint->u.translate.paint.p                     = paint_p;
       apaint->u.translate.paint.insert_root_transform = 0;
 
-      /* skip VarIdx entries */
       apaint->u.translate.dx = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.translate.dy = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE )
@@ -557,14 +526,10 @@
       apaint->u.rotate.paint.p                     = paint_p;
       apaint->u.rotate.paint.insert_root_transform = 0;
 
-      /* skip VarIdx entries */
       apaint->u.rotate.angle = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
 
       apaint->u.rotate.center_x = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.rotate.center_y = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW )
@@ -584,16 +549,11 @@
       apaint->u.skew.paint.p                     = paint_p;
       apaint->u.skew.paint.insert_root_transform = 0;
 
-      /* skip VarIdx entries */
       apaint->u.skew.x_skew_angle = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.skew.y_skew_angle = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
 
       apaint->u.skew.center_x = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
       apaint->u.skew.center_y = FT_NEXT_LONG( p );
-      FT_NEXT_ULONG( p );
     }
 
     else if ( apaint->format == FT_COLR_PAINTFORMAT_COMPOSITE )
@@ -814,14 +774,11 @@
     /* Iterator points at first `ColorStop` of `ColorLine`. */
     p = iterator->p;
 
-    /* skip VarIdx entries */
     color_stop->stop_offset = FT_NEXT_USHORT ( p );
-    FT_NEXT_ULONG ( p );
 
     color_stop->color.palette_index = FT_NEXT_USHORT ( p );
 
     color_stop->color.alpha = FT_NEXT_USHORT ( p );
-    FT_NEXT_ULONG ( p );
 
     iterator->p = p;
     iterator->current_color_stop++;



reply via email to

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