Exemple #1
0
	def pyToGLIF(self, py):
		py = stripText(py)
		glyph = Glyph()
		exec py in {"glyph" : glyph, "pointPen" : glyph}
		glif = writeGlyphToString(glyph.name, glyphObject=glyph, drawPointsFunc=glyph.drawPoints, formatVersion=1)
		glif = "\n".join(glif.splitlines()[1:])
		return glif
Exemple #2
0
	def pyToGLIF(self, py):
		py = stripText(py)
		glyph = Glyph()
		exec(py, {"glyph" : glyph, "pointPen" : glyph})
		glif = writeGlyphToString(glyph.name, glyphObject=glyph, drawPointsFunc=glyph.drawPoints, formatVersion=1)
		glif = "\n".join(glif.splitlines()[1:])
		return glif
Exemple #3
0
 def glifToPy(self, glif):
     glif = stripText(glif)
     glif = "<?xml version=\"1.0\"?>\n" + glif
     glyph = Glyph()
     readGlyphFromString(glif,
                         glyphObject=glyph,
                         pointPen=glyph,
                         validate=True)
     return glyph.py()
Exemple #4
0
 def pyToGLIF(self, py):
     py = stripText(py)
     glyph = Glyph()
     exec(py, {"glyph": glyph, "pointPen": glyph})
     glif = writeGlyphToString(glyph.name,
                               glyphObject=glyph,
                               drawPointsFunc=glyph.drawPoints,
                               formatVersion=1,
                               validate=True)
     # discard the first line containing the xml declaration
     return "\n".join(islice(glif.splitlines(), 1, None))
Exemple #5
0
	def glifToPy(self, glif):
		glif = stripText(glif)
		glif = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + glif
		glyph = Glyph()
		readGlyphFromString(glif, glyphObject=glyph, pointPen=glyph)
		return glyph.py()
Exemple #6
0
	def assertEqual(self, first, second, msg=None):
		if isinstance(first, basestring):
			first = stripText(first)
		if isinstance(second, basestring):
			second = stripText(second)
		return super(TestGLIF1, self).assertEqual(first, second, msg=msg)
Exemple #7
0
 def glifToPy(self, glif):
     glif = stripText(glif)
     glif = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + glif
     glyph = Glyph()
     readGlyphFromString(glif, glyphObject=glyph, pointPen=glyph)
     return glyph.py()
Exemple #8
0
 def assertEqual(self, first, second, msg=None):
     if isinstance(first, basestring):
         first = stripText(first)
     if isinstance(second, basestring):
         second = stripText(second)
     return super(TestGLIF1, self).assertEqual(first, second, msg=msg)