File: test_glyphs3.py

package info (click to toggle)
python-babelfont 3.0.6~ds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,740 kB
  • sloc: xml: 33,013; python: 5,762; makefile: 68
file content (22 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from babelfont import load


def test_load_open_shape():
    font = load("tests/data/GlyphsFileFormatv3.glyphs")
    assert font.glyphs["A"].layers[1].shapes[0].closed == False


def test_designspace():
    font = load("tests/data/Designspace.glyphs")
    assert len(font.axes) == 1
    assert font.axes[0].name.get_default() == "Weight"
    assert font.axes[0].tag == "wght"
    # Axes values are in userspace units
    assert font.axes[0].minimum == 100
    assert font.axes[0].maximum == 600
    # Master locations are in designspace units
    assert font.masters[0].location == {"wght": 1}
    assert font.masters[1].location == {"wght": 199}
    # Instance locations are in designspace units
    assert font.instances[0].location == {"wght": 1}
    assert font.instances[1].location == {"wght": 7}