Ejemplo n.º 1
0
	def testGetUnicodes(self):
		src = GlyphSet(GLYPHSETDIR)
		unicodes = src.getUnicodes()
		for glyphName in src.keys():
			g = src[glyphName]
			g.drawPoints(None)  # load attrs
			if not hasattr(g, "unicodes"):
				self.assertEqual(unicodes[glyphName], [])
			else:
				self.assertEqual(g.unicodes, unicodes[glyphName])
Ejemplo n.º 2
0
 def testGetUnicodes(self):
     src = GlyphSet(GLYPHSETDIR)
     unicodes = src.getUnicodes()
     for glyphName in src.keys():
         g = src[glyphName]
         g.drawPoints(None)  # load attrs
         if not hasattr(g, "unicodes"):
             self.assertEqual(unicodes[glyphName], [])
         else:
             self.assertEqual(g.unicodes, unicodes[glyphName])
Ejemplo n.º 3
0
	def getCharacterMapping(self):
		"""
		Return a dictionary that maps unicode values (ints) to
		lists of glyph names.
		"""
		glyphsPath = os.path.join(self._path, GLYPHS_DIRNAME)
		glyphSet = GlyphSet(glyphsPath)
		allUnicodes = glyphSet.getUnicodes()
		cmap = {}
		for glyphName, unicodes in allUnicodes.iteritems():
			for code in unicodes:
				if code in cmap:
					cmap[code].append(glyphName)
				else:
					cmap[code] = [glyphName]
		return cmap