aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/ttLib/tables/_a_v_a_r.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/ttLib/tables/_a_v_a_r.py')
-rw-r--r--Lib/fontTools/ttLib/tables/_a_v_a_r.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/fontTools/ttLib/tables/_a_v_a_r.py b/Lib/fontTools/ttLib/tables/_a_v_a_r.py
index 2b6a40ed..16f2a219 100644
--- a/Lib/fontTools/ttLib/tables/_a_v_a_r.py
+++ b/Lib/fontTools/ttLib/tables/_a_v_a_r.py
@@ -1,4 +1,3 @@
-from fontTools.misc.py23 import bytesjoin
from fontTools.misc import sstruct
from fontTools.misc.fixedTools import (
fixedToFloat as fi2fl,
@@ -6,6 +5,7 @@ from fontTools.misc.fixedTools import (
floatToFixedToStr as fl2str,
strToFixedToFloat as str2fl,
)
+from fontTools.misc.textTools import bytesjoin
from fontTools.ttLib import TTLibError
from . import DefaultTable
import struct
@@ -28,6 +28,28 @@ assert sstruct.calcsize(AVAR_HEADER_FORMAT) == 8, sstruct.calcsize(AVAR_HEADER_F
class table__a_v_a_r(DefaultTable.DefaultTable):
+ """Axis Variations Table
+
+ This class represents the ``avar`` table of a variable font. The object has one
+ substantive attribute, ``segments``, which maps axis tags to a segments dictionary::
+
+ >>> font["avar"].segments # doctest: +SKIP
+ {'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
+ ``avar`` segment 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.
+ """
dependencies = ["fvar"]