예제 #1
0
 def test_already_quadratic(self):
     glyph = Glyph()
     pen = glyph.getPen()
     pen.moveTo((0, 0))
     pen.qCurveTo((1, 1), (2, 2))
     pen.closePath()
     assert not glyph_to_quadratic(glyph)
예제 #2
0
 def test_ignore_components(self):
     glyph = Glyph()
     pen = glyph.getPen()
     pen.addComponent('a', (1, 0, 0, 1, 0, 0))
     pen.moveTo((0, 0))
     pen.curveTo((1, 1), (2, 2), (3, 3))
     pen.closePath()
     assert glyph_to_quadratic(glyph)
     assert len(glyph.components) == 1
예제 #3
0
 def test_open_paths(self):
     glyph = Glyph()
     pen = glyph.getPen()
     pen.moveTo((0, 0))
     pen.lineTo((1, 1))
     pen.curveTo((2, 2), (3, 3), (4, 4))
     pen.endPath()
     assert glyph_to_quadratic(glyph)
     # open contour is still open
     assert glyph[-1][0].segmentType == "move"
예제 #4
0
 def test_single_glyph(self, fonts):
     assert glyph_to_quadratic(fonts[0]['a'], max_err=4.096,
                               reverse_direction=True)