def test_glyph_defcon_behavior(): glyph = Glyph() glyph.appendAnchor(Anchor(1, 2, "top")) glyph.appendAnchor({"x": 3, "y": 4, "name": "bottom"}) assert glyph.anchors == [Anchor(1, 2, "top"), Anchor(3, 4, "bottom")] glyph = Glyph() glyph.appendContour(Contour([Point(1, 2)])) assert glyph.contours == [Contour([Point(1, 2)])] glyph = Glyph() glyph.appendGuideline(Guideline(x=1)) glyph.appendGuideline({"x": 2}) assert glyph.guidelines == [Guideline(x=1), Guideline(x=2)]
def layer() -> Layer: a = Glyph("a") pen = a.getPen() pen.moveTo((8, 0)) pen.lineTo((18, 0)) pen.lineTo((18, 20)) pen.lineTo((8, 20)) pen.closePath() a.width = 30 a.appendAnchor({"x": 10, "y": 30, "name": "top"}) b = Glyph("b", width=a.width, components=[Component("a", (1, 0, 0, 1, 2, -5))]) layer = Layer(glyphs=[a, b]) return layer