add ClipList.Format so we can bump when we finally get >16bit GIDs
https://github.com/googlefonts/colr-gradients-spec/issues/346
This commit is contained in:
parent
9876f3c5c0
commit
800bf85b2f
@ -252,6 +252,7 @@ def buildCOLR(
|
||||
|
||||
def buildClipList(clipBoxes: Dict[str, _ClipBoxInput]) -> ot.ClipList:
|
||||
clipList = ot.ClipList()
|
||||
clipList.Format = 0
|
||||
clipList.clips = {name: buildClipBox(box) for name, box in clipBoxes.items()}
|
||||
return clipList
|
||||
|
||||
|
@ -1601,7 +1601,8 @@ otData = [
|
||||
('LOffset', 'Paint', 'LayerCount', 0, 'Array of offsets to Paint tables, from the start of the LayerList table.'),
|
||||
]),
|
||||
|
||||
('ClipList', [
|
||||
('ClipListFormat0', [
|
||||
('uint8', 'Format', None, None, 'Format for ClipList with 16bit glyph IDs: 0'),
|
||||
('uint32', 'ClipCount', None, None, 'Number of Clip records.'),
|
||||
('struct', 'ClipRecord', 'ClipCount', 0, 'Array of Clip records sorted by glyph ID.'),
|
||||
]),
|
||||
|
@ -1307,7 +1307,7 @@ class ClipBox(getFormatSwitchingBaseTableClass("uint8")):
|
||||
return f"{self.__class__.__name__}{self.as_tuple()}"
|
||||
|
||||
|
||||
class ClipList(BaseTable):
|
||||
class ClipList(getFormatSwitchingBaseTableClass("uint8")):
|
||||
|
||||
def populateDefaults(self, propagator=None):
|
||||
if not hasattr(self, "clips"):
|
||||
@ -1410,6 +1410,8 @@ class ClipList(BaseTable):
|
||||
tableName = name if name else self.__class__.__name__
|
||||
if attrs is None:
|
||||
attrs = []
|
||||
if hasattr(self, "Format"):
|
||||
attrs.append(("Format", self.Format))
|
||||
xmlWriter.begintag(tableName, attrs)
|
||||
xmlWriter.newline()
|
||||
# sort clips alphabetically to ensure deterministic XML dump
|
||||
|
@ -1681,6 +1681,7 @@ class BuildCOLRTest(object):
|
||||
},
|
||||
)
|
||||
|
||||
assert colr.table.ClipList.Format == 0
|
||||
clipBoxes = colr.table.ClipList.clips
|
||||
assert [
|
||||
(baseGlyph, clipBox.as_tuple()) for baseGlyph, clipBox in clipBoxes.items()
|
||||
|
@ -298,13 +298,14 @@ COLR_V1_SAMPLE = (
|
||||
(b" \x00", "Paint.Alpha (0.5)"),
|
||||
|
||||
# ClipList
|
||||
(b'\x00', "ClipList.Format (0)"),
|
||||
(b'\x00\x00\x00\x02', "ClipList.ClipCount (2)"),
|
||||
(b'\x00\x0a', "ClipRecord[0].StartGlyphID (10)"),
|
||||
(b'\x00\x0a', "ClipRecord[0].EndGlyphID (10)"),
|
||||
(b'\x00\x00\x12', "Offset to ClipBox subtable from beginning of ClipList (18)"),
|
||||
(b'\x00\x00\x13', "Offset to ClipBox subtable from beginning of ClipList (19)"),
|
||||
(b'\x00\x0e', "ClipRecord[1].StartGlyphID (14)"),
|
||||
(b'\x00\x0f', "ClipRecord[1].EndGlyphID (15)"),
|
||||
(b'\x00\x00\x1f', "Offset to ClipBox subtable from beginning of ClipList (31)"),
|
||||
(b'\x00\x00\x20', "Offset to ClipBox subtable from beginning of ClipList (32)"),
|
||||
|
||||
(b'\x01', "ClipBox.Format (1)"),
|
||||
(b'\x00\x00', "ClipBox.xMin (0)"),
|
||||
@ -505,7 +506,7 @@ COLR_V1_XML = [
|
||||
' <dy value="258"/>',
|
||||
" </Paint>",
|
||||
"</LayerList>",
|
||||
"<ClipList>",
|
||||
'<ClipList Format="0">',
|
||||
" <Clip>",
|
||||
' <Glyph value="glyph00010"/>',
|
||||
' <ClipBox Format="1">',
|
||||
|
Loading…
x
Reference in New Issue
Block a user