self.assertEqual(glyphNameToFileName("A.alt", None), "A_.alt.glif") self.assertEqual(glyphNameToFileName("A.Alt", None), "A_.A_lt.glif") self.assertEqual(glyphNameToFileName(".notdef", None), "_notdef.glif") self.assertEqual(glyphNameToFileName("T_H", None), "T__H_.glif") self.assertEqual(glyphNameToFileName("T_h", None), "T__h.glif") self.assertEqual(glyphNameToFileName("t_h", None), "t_h.glif") self.assertEqual(glyphNameToFileName("F_F_I", None), "F__F__I_.glif") self.assertEqual(glyphNameToFileName("f_f_i", None), "f_f_i.glif") self.assertEqual(glyphNameToFileName("AE", None), "A_E_.glif") self.assertEqual(glyphNameToFileName("Ae", None), "A_e.glif") self.assertEqual(glyphNameToFileName("ae", None), "ae.glif") self.assertEqual(glyphNameToFileName("aE", None), "aE_.glif") self.assertEqual(glyphNameToFileName("a.alt", None), "a.alt.glif") self.assertEqual(glyphNameToFileName("A.aLt", None), "A_.aL_t.glif") self.assertEqual(glyphNameToFileName("A.alT", None), "A_.alT_.glif") self.assertEqual(glyphNameToFileName("Aacute_V.swash", None), "A_acute_V_.swash.glif") self.assertEqual(glyphNameToFileName(".notdef", None), "_notdef.glif") self.assertEqual(glyphNameToFileName("con", None), "_con.glif") self.assertEqual(glyphNameToFileName("CON", None), "C_O_N_.glif") self.assertEqual(glyphNameToFileName("con.alt", None), "_con.alt.glif") self.assertEqual(glyphNameToFileName("alt.con", None), "alt._con.glif") if __name__ == "__main__": from ufoLib.test.testSupport import runTests import sys if len(sys.argv) > 1 and os.path.isdir(sys.argv[-1]): GLYPHSETDIR = sys.argv.pop() runTests()
infoObject.styleMapStyleName = new writer = UFOWriter(self.dstDir, formatVersion=1) writer.writeInfo(infoObject) writtenData = self.readPlist() self.assertEqual(writtenData["fontStyle"], old) def testWidthNameConversion(self): widthName1To2 = { "Ultra-condensed" : 1, "Extra-condensed" : 2, "Condensed" : 3, "Semi-condensed" : 4, "Medium (normal)" : 5, "Semi-expanded" : 6, "Expanded" : 7, "Extra-expanded" : 8, "Ultra-expanded" : 9 } for old, new in list(widthName1To2.items()): infoObject = self.makeInfoObject() infoObject.openTypeOS2WidthClass = new writer = UFOWriter(self.dstDir, formatVersion=1) writer.writeInfo(infoObject) writtenData = self.readPlist() self.assertEqual(writtenData["widthName"], old) if __name__ == "__main__": from ufoLib.test.testSupport import runTests runTests()