aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/ttLib/tables/otData.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/ttLib/tables/otData.py')
-rwxr-xr-xLib/fontTools/ttLib/tables/otData.py161
1 files changed, 139 insertions, 22 deletions
diff --git a/Lib/fontTools/ttLib/tables/otData.py b/Lib/fontTools/ttLib/tables/otData.py
index a6f9619e..28b40c47 100755
--- a/Lib/fontTools/ttLib/tables/otData.py
+++ b/Lib/fontTools/ttLib/tables/otData.py
@@ -1588,7 +1588,24 @@ otData = [
('LOffset', 'Paint', 'LayerCount', 0, 'Array of offsets to Paint tables, from the start of the LayerV1List table.'),
]),
+ # COLRv1 Affine2x3 uses the same column-major order to serialize a 2D
+ # Affine Transformation as the one used by fontTools.misc.transform.
+ # However, for historical reasons, the labels 'xy' and 'yx' are swapped.
+ # Their fundamental meaning is the same though.
+ # COLRv1 Affine2x3 follows the names found in FreeType and Cairo.
+ # In all case, the second element in the 6-tuple correspond to the
+ # y-part of the x basis vector, and the third to the x-part of the y
+ # basis vector.
+ # See https://github.com/googlefonts/colr-gradients-spec/pull/85
('Affine2x3', [
+ ('Fixed', 'xx', None, None, 'x-part of x basis vector'),
+ ('Fixed', 'yx', None, None, 'y-part of x basis vector'),
+ ('Fixed', 'xy', None, None, 'x-part of y basis vector'),
+ ('Fixed', 'yy', None, None, 'y-part of y basis vector'),
+ ('Fixed', 'dx', None, None, 'Translation in x direction'),
+ ('Fixed', 'dy', None, None, 'Translation in y direction'),
+ ]),
+ ('VarAffine2x3', [
('VarFixed', 'xx', None, None, 'x-part of x basis vector'),
('VarFixed', 'yx', None, None, 'y-part of x basis vector'),
('VarFixed', 'xy', None, None, 'x-part of y basis vector'),
@@ -1599,34 +1616,66 @@ otData = [
('ColorIndex', [
('uint16', 'PaletteIndex', None, None, 'Index value to use with a selected color palette.'),
+ ('F2Dot14', 'Alpha', None, None, 'Values outsided [0.,1.] reserved'),
+ ]),
+ ('VarColorIndex', [
+ ('uint16', 'PaletteIndex', None, None, 'Index value to use with a selected color palette.'),
('VarF2Dot14', 'Alpha', None, None, 'Values outsided [0.,1.] reserved'),
]),
('ColorStop', [
- ('VarF2Dot14', 'StopOffset', None, None, ''),
+ ('F2Dot14', 'StopOffset', None, None, ''),
('ColorIndex', 'Color', None, None, ''),
]),
+ ('VarColorStop', [
+ ('VarF2Dot14', 'StopOffset', None, None, ''),
+ ('VarColorIndex', 'Color', None, None, ''),
+ ]),
('ColorLine', [
('ExtendMode', 'Extend', None, None, 'Enum {PAD = 0, REPEAT = 1, REFLECT = 2}'),
('uint16', 'StopCount', None, None, 'Number of Color stops.'),
('ColorStop', 'ColorStop', 'StopCount', 0, 'Array of Color stops.'),
]),
+ ('VarColorLine', [
+ ('ExtendMode', 'Extend', None, None, 'Enum {PAD = 0, REPEAT = 1, REFLECT = 2}'),
+ ('uint16', 'StopCount', None, None, 'Number of Color stops.'),
+ ('VarColorStop', 'ColorStop', 'StopCount', 0, 'Array of Color stops.'),
+ ]),
+ # PaintColrLayers
('PaintFormat1', [
('uint8', 'PaintFormat', None, None, 'Format identifier-format = 1'),
('uint8', 'NumLayers', None, None, 'Number of offsets to Paint to read from LayerV1List.'),
('uint32', 'FirstLayerIndex', None, None, 'Index into LayerV1List.'),
]),
+ # PaintSolid
('PaintFormat2', [
('uint8', 'PaintFormat', None, None, 'Format identifier-format = 2'),
('ColorIndex', 'Color', None, None, 'A solid color paint.'),
]),
-
+ # PaintVarSolid
('PaintFormat3', [
('uint8', 'PaintFormat', None, None, 'Format identifier-format = 3'),
- ('Offset24', 'ColorLine', None, None, 'Offset (from beginning of Paint table) to ColorLine subtable.'),
+ ('VarColorIndex', 'Color', None, None, 'A solid color paint.'),
+ ]),
+
+ # PaintLinearGradient
+ ('PaintFormat4', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 4'),
+ ('Offset24', 'ColorLine', None, None, 'Offset (from beginning of PaintLinearGradient table) to ColorLine subtable.'),
+ ('int16', 'x0', None, None, ''),
+ ('int16', 'y0', None, None, ''),
+ ('int16', 'x1', None, None, ''),
+ ('int16', 'y1', None, None, ''),
+ ('int16', 'x2', None, None, ''),
+ ('int16', 'y2', None, None, ''),
+ ]),
+ # PaintVarLinearGradient
+ ('PaintFormat5', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 5'),
+ ('LOffset24To(VarColorLine)', 'ColorLine', None, None, 'Offset (from beginning of PaintVarLinearGradient table) to VarColorLine subtable.'),
('VarInt16', 'x0', None, None, ''),
('VarInt16', 'y0', None, None, ''),
('VarInt16', 'x1', None, None, ''),
@@ -1635,9 +1684,21 @@ otData = [
('VarInt16', 'y2', None, None, ''),
]),
- ('PaintFormat4', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 4'),
- ('Offset24', 'ColorLine', None, None, 'Offset (from beginning of Paint table) to ColorLine subtable.'),
+ # PaintRadialGradient
+ ('PaintFormat6', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 6'),
+ ('Offset24', 'ColorLine', None, None, 'Offset (from beginning of PaintRadialGradient table) to ColorLine subtable.'),
+ ('int16', 'x0', None, None, ''),
+ ('int16', 'y0', None, None, ''),
+ ('uint16', 'r0', None, None, ''),
+ ('int16', 'x1', None, None, ''),
+ ('int16', 'y1', None, None, ''),
+ ('uint16', 'r1', None, None, ''),
+ ]),
+ # PaintVarRadialGradient
+ ('PaintFormat7', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 7'),
+ ('LOffset24To(VarColorLine)', 'ColorLine', None, None, 'Offset (from beginning of PaintVarRadialGradient table) to VarColorLine subtable.'),
('VarInt16', 'x0', None, None, ''),
('VarInt16', 'y0', None, None, ''),
('VarUInt16', 'r0', None, None, ''),
@@ -1646,49 +1707,105 @@ otData = [
('VarUInt16', 'r1', None, None, ''),
]),
- ('PaintFormat5', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 5'),
+ # PaintSweepGradient
+ ('PaintFormat8', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 8'),
+ ('Offset24', 'ColorLine', None, None, 'Offset (from beginning of PaintSweepGradient table) to ColorLine subtable.'),
+ ('int16', 'centerX', None, None, 'Center x coordinate.'),
+ ('int16', 'centerY', None, None, 'Center y coordinate.'),
+ ('Fixed', 'startAngle', None, None, 'Start of the angular range of the gradient.'),
+ ('Fixed', 'endAngle', None, None, 'End of the angular range of the gradient.'),
+ ]),
+ # PaintVarSweepGradient
+ ('PaintFormat9', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 9'),
+ ('LOffset24To(VarColorLine)', 'ColorLine', None, None, 'Offset (from beginning of PaintVarSweepGradient table) to VarColorLine subtable.'),
+ ('VarInt16', 'centerX', None, None, 'Center x coordinate.'),
+ ('VarInt16', 'centerY', None, None, 'Center y coordinate.'),
+ ('VarFixed', 'startAngle', None, None, 'Start of the angular range of the gradient.'),
+ ('VarFixed', 'endAngle', None, None, 'End of the angular range of the gradient.'),
+ ]),
+
+ # PaintGlyph
+ ('PaintFormat10', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 10'),
('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintGlyph table) to Paint subtable.'),
('GlyphID', 'Glyph', None, None, 'Glyph ID for the source outline.'),
]),
- ('PaintFormat6', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 6'),
+ # PaintColrGlyph
+ ('PaintFormat11', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 11'),
('GlyphID', 'Glyph', None, None, 'Virtual glyph ID for a BaseGlyphV1List base glyph.'),
]),
- ('PaintFormat7', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 7'),
- ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintTransformed table) to Paint subtable.'),
- ('Affine2x3', 'Transform', None, None, 'Offset (from beginning of PaintTrasformed table) to Affine2x3 subtable.'),
+ # PaintTransform
+ ('PaintFormat12', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 12'),
+ ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintTransform table) to Paint subtable.'),
+ ('Affine2x3', 'Transform', None, None, '2x3 matrix for 2D affine transformations.'),
+ ]),
+ # PaintVarTransform
+ ('PaintFormat13', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 13'),
+ ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintVarTransform table) to Paint subtable.'),
+ ('VarAffine2x3', 'Transform', None, None, '2x3 matrix for 2D affine transformations.'),
]),
- ('PaintFormat8', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 8'),
+ # PaintTranslate
+ ('PaintFormat14', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 14'),
('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintTranslate table) to Paint subtable.'),
+ ('Fixed', 'dx', None, None, 'Translation in x direction.'),
+ ('Fixed', 'dy', None, None, 'Translation in y direction.'),
+ ]),
+ # PaintVarTranslate
+ ('PaintFormat15', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 15'),
+ ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintVarTranslate table) to Paint subtable.'),
('VarFixed', 'dx', None, None, 'Translation in x direction.'),
('VarFixed', 'dy', None, None, 'Translation in y direction.'),
]),
- ('PaintFormat9', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 9'),
+ # PaintRotate
+ ('PaintFormat16', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 16'),
('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintRotate table) to Paint subtable.'),
+ ('Fixed', 'angle', None, None, ''),
+ ('Fixed', 'centerX', None, None, ''),
+ ('Fixed', 'centerY', None, None, ''),
+ ]),
+ # PaintVarRotate
+ ('PaintFormat17', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 17'),
+ ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintVarRotate table) to Paint subtable.'),
('VarFixed', 'angle', None, None, ''),
('VarFixed', 'centerX', None, None, ''),
('VarFixed', 'centerY', None, None, ''),
]),
- ('PaintFormat10', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 10'),
+ # PaintSkew
+ ('PaintFormat18', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 18'),
('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintSkew table) to Paint subtable.'),
+ ('Fixed', 'xSkewAngle', None, None, ''),
+ ('Fixed', 'ySkewAngle', None, None, ''),
+ ('Fixed', 'centerX', None, None, ''),
+ ('Fixed', 'centerY', None, None, ''),
+ ]),
+ # PaintVarSkew
+ ('PaintFormat19', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 19'),
+ ('Offset24', 'Paint', None, None, 'Offset (from beginning of PaintVarSkew table) to Paint subtable.'),
('VarFixed', 'xSkewAngle', None, None, ''),
('VarFixed', 'ySkewAngle', None, None, ''),
('VarFixed', 'centerX', None, None, ''),
('VarFixed', 'centerY', None, None, ''),
]),
- ('PaintFormat11', [
- ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 11'),
+ # PaintComposite
+ ('PaintFormat20', [
+ ('uint8', 'PaintFormat', None, None, 'Format identifier-format = 20'),
('LOffset24To(Paint)', 'SourcePaint', None, None, 'Offset (from beginning of PaintComposite table) to source Paint subtable.'),
('CompositeMode', 'CompositeMode', None, None, 'A CompositeMode enumeration value.'),
('LOffset24To(Paint)', 'BackdropPaint', None, None, 'Offset (from beginning of PaintComposite table) to backdrop Paint subtable.'),