gvar
: Glyph Variations table
The gvar
table is an OpenType table.
- class fontTools.ttLib.tables._g_v_a_r.table__g_v_a_r(tag=None)[source]
Bases:
DefaultTable
Glyph Variations table
The
gvar
table provides the per-glyph variation data that describe how glyph outlines in theglyf
table change across the variation space that is defined for the font in thefvar
table.See also https://learn.microsoft.com/en-us/typography/opentype/spec/gvar
- dependencies = ['fvar', 'glyf']
- static compileOffsets_(offsets)[source]
Packs a list of offsets into a ‘gvar’ offset table.
Returns a pair (bytestring, tableFormat). Bytestring is the packed offset table. Format indicates whether the table uses short (tableFormat=0) or long (tableFormat=1) integers. The returned tableFormat should get packed into the flags field of the ‘gvar’ header.
- prune_pre_subset(font, options)
- subset_glyphs(s)
- fontTools.ttLib.tables._g_v_a_r.compileGlyph_(variations, pointCount, axisTags, sharedCoordIndices, *, optimizeSize=True)[source]
TupleVariation
- class fontTools.ttLib.tables.TupleVariation.TupleVariation(axes, coordinates)[source]
Bases:
object
- hasImpact()[source]
Returns True if this TupleVariation has any visible impact.
If the result is False, the TupleVariation can be omitted from the font without making any visible difference.
- static decompilePoints_(numPoints, data, offset, tableTag)[source]
(numPoints, data, offset, tableTag) –> ([point1, point2, …], newOffset)
- static compileDeltaValues_(deltas, bytearr=None, *, optimizeSize=True)[source]
[value1, value2, value3, …] –> bytearray
Emits a sequence of runs. Each run starts with a byte-sized header whose 6 least significant bits (header & 0x3F) indicate how many values are encoded in this run. The stored length is the actual length minus one; run lengths are thus in the range [1..64]. If the header byte has its most significant bit (0x80) set, all values in this run are zero, and no data follows. Otherwise, the header byte is followed by ((header & 0x3F) + 1) signed values. If (header & 0x40) is clear, the delta values are stored as signed bytes; if (header & 0x40) is set, the delta values are signed 16-bit integers.
- static decompileDeltas_(numDeltas, data, offset=0)[source]
(numDeltas, data, offset) –> ([delta, delta, …], newOffset)
- fontTools.ttLib.tables.TupleVariation.compileTupleVariationStore(variations, pointCount, axisTags, sharedTupleIndices, useSharedPoints=True, *, optimizeSize=True)[source]
- fontTools.ttLib.tables.TupleVariation.decompileTupleVariationStore(tableTag, axisTags, tupleVariationCount, pointCount, sharedTuples, data, pos, dataPos)[source]
- fontTools.ttLib.tables.TupleVariation.decompileTupleVariation_(pointCount, sharedTuples, sharedPoints, tableTag, axisTags, data, tupleData)[source]
- fontTools.ttLib.tables.TupleVariation.inferRegion_(peak)[source]
Infer start and end for a (non-intermediate) region
This helper function computes the applicability region for variation tuples whose INTERMEDIATE_REGION flag is not set in the TupleVariationHeader structure. Variation tuples apply only to certain regions of the variation space; outside that region, the tuple has no effect. To make the binary encoding more compact, TupleVariationHeaders can omit the intermediateStartTuple and intermediateEndTuple fields.