コード例 #1
0
ファイル: checkoutlinesufo.py プロジェクト: lianchan/afdko
def get_digest(digest_glyph):
    """copied from robofab ObjectsBase.py.
    """
    mp = DigestPointPen()
    digest_glyph.drawPoints(mp)
    digest = list(mp.getDigestPointsOnly(needSort=False))
    digest.append((len(digest_glyph.contours), 0))
    return digest
コード例 #2
0
def get_digest(digest_glyph):
    """copied from robofab ObjectsBase.py.
    """
    mp = DigestPointPen()
    digest_glyph.drawPoints(mp)
    digest = list(mp.getDigestPointsOnly(needSort=False))
    digest.append((len(digest_glyph.contours), 0))
    return digest
コード例 #3
0
 def test(self):
     if VERBOSE:
         print("test: '%s' for '%s'" % (glyph.name, booleanMethodName))
     testPen = DigestPointPen()
     func(*args, outPen=testPen)
     expectedPen = DigestPointPen()
     expectedGlyph.drawPoints(expectedPen)
     self.assertEqual(testPen.getDigest(), expectedPen.getDigest(), "Glyph name '%s' failed for '%s'." % (glyph.name, booleanMethodName))
コード例 #4
0
def testDigestGlyph(glyph):
    from fontPens.digestPointPen import DigestPointPen
    pen = DigestPointPen()
    glyph.drawPoints(pen)
    return (
        glyph.name,
        glyph.width,
        glyph.unicode,
        glyph.markColor,
        glyph.note,
        pen.getDigest()
    )
コード例 #5
0
def testDigestGlyph(glyph):
    from fontPens.digestPointPen import DigestPointPen
    pen = DigestPointPen()
    glyph.drawPoints(pen)
    return (
        glyph.name,
        glyph.width,
        glyph.unicode,
        glyph.markColor,
        glyph.note,
        pen.getDigest()
    )
コード例 #6
0
 def test_decompose_digest(self):
     from fontPens.digestPointPen import DigestPointPen
     component = self.getComponent_generic()
     glyph = component.glyph
     glyph.layer[component.baseGlyph]
     component.decompose()
     pointPen = DigestPointPen()
     glyph.drawPoints(pointPen)
     expected = (('beginPath', None), ((0, 0), u'line', False, 'point 0'),
                 ((0, 100), u'line', False,
                  'point 1'), ((100, 100), u'line', False, 'point 2'),
                 ((100, 0), u'line', False, 'point 3'), 'endPath')
     self.assertEqual(pointPen.getDigest(), expected)
コード例 #7
0
ファイル: test_component.py プロジェクト: moyogo/fontparts
 def test_decompose_digest(self):
     from fontPens.digestPointPen import DigestPointPen
     component = self.getComponent_generic()
     glyph = component.glyph
     glyph.layer[component.baseGlyph]
     component.decompose()
     pointPen = DigestPointPen()
     glyph.drawPoints(pointPen)
     expected = (
         ('beginPath', None),
         ((0, 0), u'line', False, 'point 0'),
         ((0, 100), u'line', False, 'point 1'),
         ((100, 100), u'line', False, 'point 2'),
         ((100, 0), u'line', False, 'point 3'),
         'endPath'
     )
     self.assertEqual(
         pointPen.getDigest(),
         expected
     )
コード例 #8
0
 def test(self):
     if VERBOSE:
         print("test: '%s' for '%s'" % (glyph.name, booleanMethodName))
     testPen = DigestPointPen()
     func(*args, outPen=testPen)
     expectedPen = DigestPointPen()
     expectedGlyph.drawPoints(expectedPen)
     self.assertEqual(testPen.getDigest(), expectedPen.getDigest(), "Glyph name '%s' failed for '%s'." % (glyph.name, booleanMethodName))