Example #1
0
 def testReversContourFromGlyphSet(self):
     glyphSet = GlyphSet(getDemoFontGlyphSetPath())
     digestPen = DigestPointPen()
     glyphSet["testglyph1"].drawPoints(digestPen)
     digest1 = digestPen.getDigest()
     digestPen = DigestPointPen()
     pen = ReverseContourPointPen(digestPen)
     glyphSet["testglyph1.reversed"].drawPoints(pen)
     digest2 = digestPen.getDigest()
     self.assertEqual(digest1, digest2)
Example #2
0
	def testReversContourFromGlyphSet(self):
		glyphSet = GlyphSet(getDemoFontGlyphSetPath())
		digestPen = DigestPointPen()
		glyphSet["testglyph1"].drawPoints(digestPen)
		digest1 = digestPen.getDigest()
		digestPen = DigestPointPen()
		pen = ReverseContourPointPen(digestPen)
		glyphSet["testglyph1.reversed"].drawPoints(pen)
		digest2 = digestPen.getDigest()
		self.assertEqual(digest1, digest2)
Example #3
0
 def testGuessSmoothPen(self):
     glyphSet = GlyphSet(getDemoFontGlyphSetPath())
     for name in glyphSet.keys():
         digestPen = DigestPointPen()
         glyphSet[name].drawPoints(digestPen)
         digest1 = digestPen.getDigest()
         digestPen = DigestPointPen()
         pen = GuessSmoothPointPen(digestPen)
         glyphSet[name].drawPoints(pen)
         digest2 = digestPen.getDigest()
         self.assertEqual(digest1, digest2)
Example #4
0
	def testGuessSmoothPen(self):
		glyphSet = GlyphSet(getDemoFontGlyphSetPath())
		for name in glyphSet.keys():
			digestPen = DigestPointPen()
			glyphSet[name].drawPoints(digestPen)
			digest1 = digestPen.getDigest()
			digestPen = DigestPointPen()
			pen = GuessSmoothPointPen(digestPen)
			glyphSet[name].drawPoints(pen)
			digest2 = digestPen.getDigest()
			self.assertEqual(digest1, digest2)
Example #5
0
 def testUFOVersusGlifImport(self):
     font = NewFont()
     font.readUFO(getDemoFontPath(), doProgress=False)
     d1 = getDigests(font)
     font.close(False)
     font = NewFont()
     importAllGlifFiles(font.naked(),
                        getDemoFontGlyphSetPath(),
                        doProgress=False)
     d2 = getDigests(font)
     self.assertEqual(d1, d2)
     font.close(False)
Example #6
0
import os
import tempfile
import shutil
import unittest

from robofab.test.testSupport import getDemoFontGlyphSetPath
from ufoLib.glifLib import GlyphSet, glyphNameToFileName, READ_MODE
from robofab.tools.glyphNameSchemes import glyphNameToShortFileName


GLYPHSETDIR = getDemoFontGlyphSetPath()


class GlyphSetTests(unittest.TestCase):

	def setUp(self):
		self.dstDir = tempfile.mktemp()
		os.mkdir(self.dstDir)

	def tearDown(self):
		shutil.rmtree(self.dstDir)

	def testRoundTrip(self):
		srcDir = GLYPHSETDIR
		dstDir = self.dstDir
		src = GlyphSet(srcDir)
		dst = GlyphSet(dstDir)
		for glyphName in src.keys():
			g = src[glyphName]
			g.drawPoints(None)  # load attrs
			dst.writeGlyph(glyphName, g, g.drawPoints)
Example #7
0
import os
import tempfile
import shutil
import unittest

from robofab.test.testSupport import getDemoFontGlyphSetPath
from robofab.glifLib import GlyphSet, glyphNameToFileName, READ_MODE
from robofab.tools.glyphNameSchemes import glyphNameToShortFileName

GLYPHSETDIR = getDemoFontGlyphSetPath()


class GlyphSetTests(unittest.TestCase):
    def setUp(self):
        self.dstDir = tempfile.mktemp()
        os.mkdir(self.dstDir)

    def tearDown(self):
        shutil.rmtree(self.dstDir)

    def testRoundTrip(self):
        srcDir = GLYPHSETDIR
        dstDir = self.dstDir
        src = GlyphSet(srcDir)
        dst = GlyphSet(dstDir)
        for glyphName in src.keys():
            g = src[glyphName]
            g.drawPoints(None)  # load attrs
            dst.writeGlyph(glyphName, g, g.drawPoints)
        # compare raw file data:
        for glyphName in src.keys():
Example #8
0
 def testShapesFromGlyphSet(self):
     glyphSet = GlyphSet(getDemoFontGlyphSetPath())
     for name in glyphSet.keys():
         self._doTest(glyphSet[name].drawPoints, name)
Example #9
0
	def testShapesFromGlyphSet(self):
		glyphSet = GlyphSet(getDemoFontGlyphSetPath())
		for name in glyphSet.keys():
			self._doTest(glyphSet[name].drawPoints, name)