avar: Axis Variations table
The avar table is an OpenType table.
- class fontTools.ttLib.tables._a_v_a_r.table__a_v_a_r(tag=None)[source]
Bases:
BaseTTXConverterAxis Variations table
This class represents the
avartable of a variable font. The object has one substantive attribute,segments, which maps axis tags to a segments dictionary:>>> font["avar"].segments {'wght': {-1.0: -1.0, 0.0: 0.0, 0.125: 0.11444091796875, 0.25: 0.23492431640625, 0.5: 0.35540771484375, 0.625: 0.5, 0.75: 0.6566162109375, 0.875: 0.81927490234375, 1.0: 1.0}, 'ital': {-1.0: -1.0, 0.0: 0.0, 1.0: 1.0}}
Notice that the segments dictionary is made up of normalized values. A valid
avarsegment mapping must contain the entries-1.0: -1.0, 0.0: 0.0, 1.0: 1.0. fontTools does not enforce this, so it is your responsibility to ensure that mappings are valid.See also https://learn.microsoft.com/en-us/typography/opentype/spec/avar
- dependencies: list[str] = ['fvar']
- renormalizeLocation(location: Mapping[str, float], font: TTFont, dropZeroes: bool = True) dict[str, float][source]
- renormalizeAxisLimits(axisLimits, font=None)[source]
Apply the avar v1 segment maps to normalized axis limits.
The values of
axisLimitsmay be (min, default, max) triples or longer sequences whose trailing elements are user-space distances (as in NormalizedAxisTripleAndDistances); only the first three elements are coordinates, so only those are mapped — the distances pass through untouched. The mapped coordinates are quantized to F2Dot14, to avoid surprise interpolations.Returns a dict mapping axis tags to tuples of the same length as the input values. avar version 2 mappings are NOT applied — the VarStore-driven part of an avar 2 table is handled separately by the instancer (see fontTools.varLib.instancer).