Exemplo n.º 1
0
 def test_appendContour(self):
     glyph = Glyph()
     glyph.dirty = False
     contour = Contour()
     glyph.appendContour(contour)
     self.assertEqual(len(glyph), 1)
     self.assertTrue(glyph.dirty)
     self.assertEqual(contour.getParent(), glyph)
Exemplo n.º 2
0
 def test_appendContour(self):
     glyph = Glyph()
     glyph.dirty = False
     contour = Contour()
     glyph.appendContour(contour)
     self.assertEqual(len(glyph), 1)
     self.assertTrue(glyph.dirty)
     self.assertEqual(contour.getParent(), glyph)
Exemplo n.º 3
0
def create_glyph(codepoint, width, contours):
    glyph = Glyph()
    glyph.name = get_glyph_name(codepoint)
    glyph.unicode = ord(codepoint)
    glyph.width = width
    for contour in contours:
        glyph.appendContour(contour)
    return glyph
Exemplo n.º 4
0
 def test_identifier(self):
     glyph = Glyph()
     contour = Contour()
     glyph.appendContour(contour)
     contour.identifier = "contour 1"
     self.assertEqual(contour.identifier, "contour 1")
     self.assertEqual(sorted(glyph.identifiers), ["contour 1"])
     contour = Contour()
     glyph.appendContour(contour)
     with self.assertRaises(AssertionError):
         contour.identifier = "contour 1"
     contour.identifier = "contour 2"
     self.assertEqual(sorted(glyph.identifiers), ["contour 1", "contour 2"])
     contour.identifier = "not contour 2 anymore"
     self.assertEqual(contour.identifier, "contour 2")
     self.assertEqual(sorted(glyph.identifiers), ["contour 1", "contour 2"])
     contour.identifier = None
     self.assertEqual(contour.identifier, "contour 2")
     self.assertEqual(sorted(glyph.identifiers), ["contour 1", "contour 2"])