From ff79338607597fd0caeb5fc570b6eedfa2fef9e4 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 2 Jul 2020 12:21:12 +0100 Subject: [PATCH] rename radial gradient Paint.Affine attribute to Transform as suggested by Peter Constable in https://github.com/PeterConstable/OT_Drafts/blob/master/COLR_V1/COLRv1formats_rev3.md#paintformat3-table-conicalradial-gradient --- Lib/fontTools/colorLib/builder.py | 8 ++++---- Lib/fontTools/ttLib/tables/otData.py | 2 +- Tests/colorLib/builder_test.py | 10 +++++----- Tests/ttLib/tables/C_O_L_R_test.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/fontTools/colorLib/builder.py b/Lib/fontTools/colorLib/builder.py index a46fc74e1..48ade4482 100644 --- a/Lib/fontTools/colorLib/builder.py +++ b/Lib/fontTools/colorLib/builder.py @@ -423,7 +423,7 @@ def buildRadialGradientPaint( c1: _PointTuple, r0: _ScalarInput, r1: _ScalarInput, - affine: Optional[_AffineInput] = None, + transform: Optional[_AffineInput] = None, ) -> ot.Paint: self = ot.Paint() @@ -435,9 +435,9 @@ def buildRadialGradientPaint( setattr(self, f"y{i}", _to_variable_int(y)) setattr(self, f"r{i}", _to_variable_int(r)) - if affine is not None and not isinstance(affine, ot.Affine2x2): - affine = buildAffine2x2(*affine) - self.Affine = affine + if transform is not None and not isinstance(transform, ot.Affine2x2): + transform = buildAffine2x2(*transform) + self.Transform = transform return self diff --git a/Lib/fontTools/ttLib/tables/otData.py b/Lib/fontTools/ttLib/tables/otData.py index 9238d6324..faec41d8c 100755 --- a/Lib/fontTools/ttLib/tables/otData.py +++ b/Lib/fontTools/ttLib/tables/otData.py @@ -1640,6 +1640,6 @@ otData = [ ('VarInt16', 'x1', None, None, ''), ('VarInt16', 'y1', None, None, ''), ('VarUInt16', 'r1', None, None, ''), - ('LOffsetTo(Affine2x2)', 'Affine', None, None, 'Offset (from beginning of Paint table) to Affine2x2 subtable.'), + ('LOffsetTo(Affine2x2)', 'Transform', None, None, 'Offset (from beginning of Paint table) to Affine2x2 subtable.'), ]), ] diff --git a/Tests/colorLib/builder_test.py b/Tests/colorLib/builder_test.py index f7651c2a6..e7ea6b614 100644 --- a/Tests/colorLib/builder_test.py +++ b/Tests/colorLib/builder_test.py @@ -337,7 +337,7 @@ def test_buildRadialGradientPaint(): assert (gradient.x1, gradient.y1) == c1 assert gradient.r0 == r0 assert gradient.r1 == r1 - assert gradient.Affine is None + assert gradient.Transform is None gradient = builder.buildRadialGradientPaint({"stops": color_stops}, c0, c1, r0, r1) assert gradient.ColorLine.Extend == builder.ExtendMode.PAD @@ -345,14 +345,14 @@ def test_buildRadialGradientPaint(): matrix = builder.buildAffine2x2(2.0, 0.0, 0.0, 2.0) gradient = builder.buildRadialGradientPaint( - color_line, c0, c1, r0, r1, affine=matrix + color_line, c0, c1, r0, r1, transform=matrix ) - assert gradient.Affine == matrix + assert gradient.Transform == matrix gradient = builder.buildRadialGradientPaint( - color_line, c0, c1, r0, r1, affine=(2.0, 0.0, 0.0, 2.0) + color_line, c0, c1, r0, r1, transform=(2.0, 0.0, 0.0, 2.0) ) - assert gradient.Affine == matrix + assert gradient.Transform == matrix def test_buildLayerV1Record(): diff --git a/Tests/ttLib/tables/C_O_L_R_test.py b/Tests/ttLib/tables/C_O_L_R_test.py index ae4787ce6..a74440ec4 100644 --- a/Tests/ttLib/tables/C_O_L_R_test.py +++ b/Tests/ttLib/tables/C_O_L_R_test.py @@ -268,12 +268,12 @@ COLR_V1_XML = [ ' ', ' ', ' ', - " ", + " ", ' ', ' ', ' ', ' ', - " ", + " ", " ", " ", " ",