Debian Codegraph @

tests/test1018.py

raw symbols SCIP
1 #Needs: fonts/Ambrosia.sfd
2
3 #Test adding anchors and non linear transform of anchors
4 import sys, fontforge
5
6 ambrosia = sys.argv[1]
7 font = fontforge.open(ambrosia)
8
9 glyph = font["a"]
10 glyph.addAnchorPoint("top", "base", 176, 580)
11 glyph.addAnchorPoint("bottom", "base", 176, -20)
12
13 glyph = glyph.nltransform("200+(x-200)*abs(y-300)/300", "y^2")
14
15 assert glyph.anchorPoints[0][2] == 174.4, f"{glyph.anchorPoints[0][2]}"
16 assert glyph.anchorPoints[0][3] == 400, f"{glyph.anchorPoints[0][3]}"
17 assert glyph.anchorPoints[1][2] == 177.6, f"{glyph.anchorPoints[1][2]}"
18 assert glyph.anchorPoints[1][3] == 32767, f"{glyph.anchorPoints[1][3]}"