[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
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++;