diff --git a/Lib/fontTools/colorLib/builder.py b/Lib/fontTools/colorLib/builder.py index c2315afbf..d2e35d810 100644 --- a/Lib/fontTools/colorLib/builder.py +++ b/Lib/fontTools/colorLib/builder.py @@ -252,7 +252,7 @@ def buildCOLR( def buildClipList(clipBoxes: Dict[str, _ClipBoxInput]) -> ot.ClipList: clipList = ot.ClipList() - clipList.Format = 0 + clipList.Format = 1 clipList.clips = {name: buildClipBox(box) for name, box in clipBoxes.items()} return clipList @@ -265,7 +265,7 @@ def buildClipBox(clipBox: _ClipBoxInput) -> ot.ClipBox: if n not in (4, 5): raise ValueError(f"Invalid ClipBox: expected 4 or 5 values, found {n}") clip.xMin, clip.yMin, clip.xMax, clip.yMax = intRect(clipBox[:4]) - clip.Format = int(n == 5) + clip.Format = int(n == 5) + 1 if n == 5: clip.VarIndexBase = int(clipBox[4]) return clip diff --git a/Lib/fontTools/ttLib/tables/otData.py b/Lib/fontTools/ttLib/tables/otData.py index 416a932a6..dd4033e43 100755 --- a/Lib/fontTools/ttLib/tables/otData.py +++ b/Lib/fontTools/ttLib/tables/otData.py @@ -1601,8 +1601,8 @@ otData = [ ('LOffset', 'Paint', 'LayerCount', 0, 'Array of offsets to Paint tables, from the start of the LayerList table.'), ]), - ('ClipListFormat0', [ - ('uint8', 'Format', None, None, 'Format for ClipList with 16bit glyph IDs: 0'), + ('ClipListFormat1', [ + ('uint8', 'Format', None, None, 'Format for ClipList with 16bit glyph IDs: 1'), ('uint32', 'ClipCount', None, None, 'Number of Clip records.'), ('struct', 'ClipRecord', 'ClipCount', 0, 'Array of Clip records sorted by glyph ID.'), ]), @@ -1613,16 +1613,16 @@ otData = [ ('Offset24', 'ClipBox', None, None, 'Offset to a ClipBox table.'), ]), - ('ClipBoxFormat0', [ - ('uint8', 'Format', None, None, 'Format for ClipBox without variation: set to 0.'), + ('ClipBoxFormat1', [ + ('uint8', 'Format', None, None, 'Format for ClipBox without variation: set to 1.'), ('int16', 'xMin', None, None, 'Minimum x of clip box.'), ('int16', 'yMin', None, None, 'Minimum y of clip box.'), ('int16', 'xMax', None, None, 'Maximum x of clip box.'), ('int16', 'yMax', None, None, 'Maximum y of clip box.'), ]), - ('ClipBoxFormat1', [ - ('uint8', 'Format', None, None, 'Format for variable ClipBox: set to 1.'), + ('ClipBoxFormat2', [ + ('uint8', 'Format', None, None, 'Format for variable ClipBox: set to 2.'), ('int16', 'xMin', None, None, 'Minimum x of clip box.'), ('int16', 'yMin', None, None, 'Minimum y of clip box.'), ('int16', 'xMax', None, None, 'Maximum x of clip box.'), diff --git a/Tests/colorLib/builder_test.py b/Tests/colorLib/builder_test.py index 0a99a0288..f0a09924f 100644 --- a/Tests/colorLib/builder_test.py +++ b/Tests/colorLib/builder_test.py @@ -1681,7 +1681,7 @@ class BuildCOLRTest(object): }, ) - assert colr.table.ClipList.Format == 0 + assert colr.table.ClipList.Format == 1 clipBoxes = colr.table.ClipList.clips assert [ (baseGlyph, clipBox.as_tuple()) for baseGlyph, clipBox in clipBoxes.items() @@ -1689,8 +1689,8 @@ class BuildCOLRTest(object): ("a", (0, 0, 1000, 1000, 0)), ("c", (-101, -201, 1101, 1201)), ] - assert clipBoxes["a"].Format == 1 - assert clipBoxes["c"].Format == 0 + assert clipBoxes["a"].Format == 2 + assert clipBoxes["c"].Format == 1 class TrickyRadialGradientTest: diff --git a/Tests/ttLib/tables/C_O_L_R_test.py b/Tests/ttLib/tables/C_O_L_R_test.py index aeee80f3f..aaf330030 100644 --- a/Tests/ttLib/tables/C_O_L_R_test.py +++ b/Tests/ttLib/tables/C_O_L_R_test.py @@ -298,7 +298,7 @@ COLR_V1_SAMPLE = ( (b" \x00", "Paint.Alpha (0.5)"), # ClipList - (b'\x00', "ClipList.Format (0)"), + (b'\x01', "ClipList.Format (1)"), (b'\x00\x00\x00\x02', "ClipList.ClipCount (2)"), (b'\x00\x0a', "ClipRecord[0].StartGlyphID (10)"), (b'\x00\x0a', "ClipRecord[0].EndGlyphID (10)"), @@ -307,14 +307,14 @@ COLR_V1_SAMPLE = ( (b'\x00\x0f', "ClipRecord[1].EndGlyphID (15)"), (b'\x00\x00\x20', "Offset to ClipBox subtable from beginning of ClipList (32)"), - (b'\x01', "ClipBox.Format (1)"), + (b'\x02', "ClipBox.Format (2)"), (b'\x00\x00', "ClipBox.xMin (0)"), (b'\x00\x00', "ClipBox.yMin (0)"), (b'\x01\xf4', "ClipBox.xMax (500)"), (b'\x01\xf4', "ClipBox.yMax (500)"), (b'\x00\x00\x00\t', "ClipBox.VarIndexBase (9)"), - (b'\x00', "ClipBox.Format (0)"), + (b'\x01', "ClipBox.Format (1)"), (b'\x00\x00', "ClipBox.xMin (0)"), (b'\x00\x00', "ClipBox.yMin (0)"), (b'\x03\xe8', "ClipBox.xMax (1000)"), @@ -506,10 +506,10 @@ COLR_V1_XML = [ ' ', " ", "", - '', + '', " ", ' ', - ' ', + ' ', ' ', ' ', ' ', @@ -520,7 +520,7 @@ COLR_V1_XML = [ " ", ' ', ' ', - ' ', + ' ', ' ', ' ', ' ',