Skip to content

Commit

Permalink
fontBuilder_test: test error with cubics but glyf format 0
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed May 23, 2023
1 parent a421f90 commit 9bb3b65
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/fontBuilder/fontBuilder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ def test_build_ttf(tmpdir):
_verifyOutput(outPath)


def test_build_cubic_ttf(tmp_path):
pen = TTGlyphPen(None)
pen.moveTo((100, 100))
pen.curveTo((200, 200), (300, 300), (400, 400))
pen.closePath()
glyph = pen.glyph()
glyphs = {"A": glyph}

fb = FontBuilder(1000, isTTF=True, glyphDataFormat=0)
with pytest.raises(
ValueError, match="Glyph 'A' has cubic Bezier outlines, but glyphDataFormat=0"
):
fb.setupGlyf(glyphs)

fb = FontBuilder(1000, isTTF=True, glyphDataFormat=1)
fb.setupGlyf(glyphs)
assert "A" in fb.font["glyf"].glyphs


def test_build_otf(tmpdir):
outPath = os.path.join(str(tmpdir), "test.otf")

Expand Down

0 comments on commit 9bb3b65

Please sign in to comment.