diff --git a/Lib/fontTools/colorLib/builder.py b/Lib/fontTools/colorLib/builder.py index b6a54eae5..410f2b787 100644 --- a/Lib/fontTools/colorLib/builder.py +++ b/Lib/fontTools/colorLib/builder.py @@ -493,11 +493,11 @@ def buildPaintGlyph(glyph: str, paint: _PaintInput) -> ot.Paint: return self -def buildPaintColorGlyph( +def buildPaintColrSlice( glyph: str, firstLayerIndex: int = 0, lastLayerIndex: int = 255 ) -> ot.Paint: self = ot.Paint() - self.Format = int(ot.Paint.Format.PaintColorGlyph) + self.Format = int(ot.Paint.Format.PaintColrSlice) self.Glyph = glyph if firstLayerIndex > lastLayerIndex: raise ValueError( @@ -539,7 +539,7 @@ _PAINT_BUILDERS = { 2: buildPaintLinearGradient, 3: buildPaintRadialGradient, 4: buildPaintGlyph, - 5: buildPaintColorGlyph, + 5: buildPaintColrSlice, 6: buildPaintTransform, 7: buildPaintComposite, } diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py index 25a2ed201..4d46a9a2c 100644 --- a/Lib/fontTools/ttLib/tables/otTables.py +++ b/Lib/fontTools/ttLib/tables/otTables.py @@ -1331,7 +1331,7 @@ class Paint(getFormatSwitchingBaseTableClass("uint8")): PaintLinearGradient = 2 PaintRadialGradient = 3 PaintGlyph = 4 - PaintColorGlyph = 5 + PaintColrSlice = 5 PaintTransform = 6 PaintComposite = 7 diff --git a/Tests/colorLib/builder_test.py b/Tests/colorLib/builder_test.py index c91e85418..35eb1c6a6 100644 --- a/Tests/colorLib/builder_test.py +++ b/Tests/colorLib/builder_test.py @@ -437,23 +437,23 @@ def test_buildPaintGlyph_from_dict(): assert layer.Paint.r0.value == 4 -def test_buildPaintColorGlyph(): - paint = builder.buildPaintColorGlyph("a") - assert paint.Format == ot.Paint.Format.PaintColorGlyph +def test_buildPaintColrSlice(): + paint = builder.buildPaintColrSlice("a") + assert paint.Format == ot.Paint.Format.PaintColrSlice assert paint.Glyph == "a" assert paint.FirstLayerIndex == 0 assert paint.LastLayerIndex == 255 - paint = builder.buildPaintColorGlyph("a", firstLayerIndex=1, lastLayerIndex=254) + paint = builder.buildPaintColrSlice("a", firstLayerIndex=1, lastLayerIndex=254) assert paint.FirstLayerIndex == 1 assert paint.LastLayerIndex == 254 with pytest.raises(ValueError, match="Expected first <= last index"): - builder.buildPaintColorGlyph("a", 255, 0) + builder.buildPaintColrSlice("a", 255, 0) with pytest.raises(OverflowError, match="firstLayerIndex .* out of range"): - builder.buildPaintColorGlyph("a", -1, 255) + builder.buildPaintColrSlice("a", -1, 255) with pytest.raises(OverflowError, match="lastLayerIndex .* out of range"): - builder.buildPaintColorGlyph("a", 0, 256) + builder.buildPaintColrSlice("a", 0, 256) def test_buildPaintTransform(): diff --git a/Tests/ttLib/tables/C_O_L_R_test.py b/Tests/ttLib/tables/C_O_L_R_test.py index 67811f7f5..adaa9e383 100644 --- a/Tests/ttLib/tables/C_O_L_R_test.py +++ b/Tests/ttLib/tables/C_O_L_R_test.py @@ -324,14 +324,14 @@ COLR_V1_XML = [ " ", " ", ' ', - ' ', + ' ', ' ', ' ', ' ', " ", ' ', ' ', - ' ', + ' ', ' ', ' ', ' ',