def testStringWidth(self): "Test TTFont.stringWidth" font = TTFont("Vera", "Vera.ttf") self.assert_(font.stringWidth("test", 10) > 0) width = font.stringWidth(utf8(0x2260) * 2, 1000) expected = font.face.getCharWidth(0x2260) * 2 self.assertNear(width,expected)
def testStringWidth(self): "Test TTFont.stringWidth" font = TTFont("Vera", "Vera.ttf") self.assert_(font.stringWidth("test", 10) > 0) width = font.stringWidth(utf8(0x2260) * 2, 1000) expected = font.face.getCharWidth(0x2260) * 2 self.assertNear(width, expected)
def testStringWidth(self): "Test TTFont.stringWidth" font = TTFont("TestFont", "luxiserif.ttf") self.assert_(font.stringWidth("test", 10) > 0) width = font.stringWidth(utf8(0x2260) * 2, 1000) expected = font.face.getCharWidth(0x2260) * 2 self.assert_(abs(width - expected) < 0.01, "%g != %g" % (width, expected))