當前位置: 首頁>>代碼示例>>Python>>正文


Python digestPen.DigestPointPen類代碼示例

本文整理匯總了Python中robofab.pens.digestPen.DigestPointPen的典型用法代碼示例。如果您正苦於以下問題:Python DigestPointPen類的具體用法?Python DigestPointPen怎麽用?Python DigestPointPen使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DigestPointPen類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

 def __init__(self, glyph, soft=False):
     p = DigestPointPen(ignoreSmoothAndName=True)
     glyph.drawPoints(p)
     self.digest = p.getDigest()
     self.glyph = MathGlyph(glyph)
     self.t = time.time()
     self.name = glyph.name
     self.soft = soft
開發者ID:LettError,項目名稱:tools,代碼行數:8,代碼來源:interpolatedStatesTool.py

示例2: getDigest

def getDigest(dGlyph):
	"""copied from robofab ObjectsBase.py.
	"""
	mp = DigestPointPen()
	dGlyph.drawPoints(mp)
	digest = mp.getDigestPointsOnly(needSort=False)
	# we need to round to int.
	intDigest = digest #[ (int(p[0]), int(p[1])) for p in digest]
	return intDigest
開發者ID:jessamynsmith,項目名稱:afdko,代碼行數:9,代碼來源:CheckOutlinesUFO.py

示例3: testFabPenCompatibility

	def testFabPenCompatibility(self):
		for glyph in self.font:
			digestPen = DigestPointPen(ignoreSmoothAndName=True)
			pen = FabToFontToolsPenAdapter(SegmentToPointPen(digestPen))
			glyph.draw(pen)
			digest1 = digestPen.getDigest()
			digestPen = DigestPointPen(ignoreSmoothAndName=True)
			glyph.drawPoints(digestPen)
			digest2 = digestPen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same for gl.draw() and gl.drawPoints()" % glyph.name)
開發者ID:charlesmchen,項目名稱:typefacet,代碼行數:10,代碼來源:test_objectsUFO.py

示例4: _doTest

	def _doTest(self, shapeFunc, shapeName):
		pen = DigestPointPen(ignoreSmoothAndName=True)
		shapeFunc(pen)
		digest1 = pen.getDigest()

		digestPen = DigestPointPen(ignoreSmoothAndName=True)
		pen = PointToSegmentPen(SegmentToPointPen(digestPen))
		shapeFunc(pen)
		digest2 = digestPen.getDigest()
		self.assertEqual(digest1, digest2, "%r failed round tripping" % shapeName)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:10,代碼來源:test_pens.py

示例5: testSegmentPenInterface

	def testSegmentPenInterface(self):
		for glyph in self.font:
			digestPen = DigestPointPen(ignoreSmoothAndName=True)
			pen = SegmentToPointPen(digestPen)
			glyph.draw(pen)
			digest1 = digestPen.getDigest()
			digestPen = DigestPointPen(ignoreSmoothAndName=True)
			glyph.drawPoints(digestPen)
			digest2 = digestPen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same for gl.draw() and gl.drawPoints()" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:10,代碼來源:test_objectsUFO.py

示例6: Glyph2String

def Glyph2String(glyph):
	from robofab.pens.digestPen import DigestPointPen
	import pickle
	p = DigestPointPen(glyph)
	glyph.drawPoints(p)
	info = {}
	info['name'] = glyph.name
	info['width'] = glyph.width
	info['points'] = p.getDigest()
	return str(pickle.dumps(info))
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:10,代碼來源:remote.py

示例7: testReversContourFromGlyphSet

	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)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:10,代碼來源:test_pens.py

示例8: testGuessSmoothPen

	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)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:11,代碼來源:test_pens.py

示例9: testScaleGlyph

	def testScaleGlyph(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			glyph.scale((2, 2))
			glyph.scale((.5, .5))
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after scaling twice" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:11,代碼來源:test_objectsUFO.py

示例10: testMoveGlyph

	def testMoveGlyph(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			glyph.move((100, 200))
			glyph.move((-100, -200))
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after moving twice" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:11,代碼來源:test_objectsUFO.py

示例11: testDigestGlyph

def testDigestGlyph(glyph):
    from robofab.pens.digestPen import DigestPointPen
    pen = DigestPointPen()
    glyph.draw(pen)
    return (
            glyph.name,
            glyph.width,
            glyph.unicode,
            glyph.mark,
            glyph.note,
            pen.getDigest()
        )
開發者ID:moyogo,項目名稱:glyphconstruction,代碼行數:12,代碼來源:glyphConstructionBuilder.py

示例12: testStartSegment

	def testStartSegment(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			for contour in glyph:
				contour.setStartSegment(2)
				contour.setStartSegment(-2)
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after seting start segment twice" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:12,代碼來源:test_objectsUFO.py

示例13: testAppendSegment

	def testAppendSegment(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			for contour in glyph:
				contour.insertSegment(2, "curve", [(100, 100), (200, 200), (300, 300)])
				contour.removeSegment(2)
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after inserting and removing segment" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:12,代碼來源:test_objectsUFO.py

示例14: testReverseContour

	def testReverseContour(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			for contour in glyph:
				contour.reverseContour()
				contour.reverseContour()
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after reversing twice" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:12,代碼來源:test_objectsUFO.py

示例15: testCopyGlyph

	def testCopyGlyph(self):
		for glyph in self.font:
			pen = DigestPointPen()
			glyph.drawPoints(pen)
			digest1 = pen.getDigest()
			copy = glyph.copy()
			pen = DigestPointPen()
			copy.drawPoints(pen)
			digest2 = pen.getDigest()
			self.assertEqual(digest1, digest2, "%r not the same after copying" % glyph.name)
			self.assertEqual(glyph.lib, copy.lib, "%r's lib not the same after copying" % glyph.name)
			self.assertEqual(glyph.width, copy.width, "%r's width not the same after copying" % glyph.name)
			self.assertEqual(glyph.unicodes, copy.unicodes, "%r's unicodes not the same after copying" % glyph.name)
開發者ID:SayCV,項目名稱:tools-FDK,代碼行數:13,代碼來源:test_objectsUFO.py


注:本文中的robofab.pens.digestPen.DigestPointPen類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。