def test_superscript_digits(self): """Tests that 'numr' features maps digits to Unicode superscripts.""" ascii_digits = '0123456789' superscript_digits = u'⁰¹²³⁴⁵⁶⁷⁸⁹' for font_file in self.font_files: numr_glyphs = layout.get_advances(ascii_digits, font_file, '--features=numr') superscript_glyphs = layout.get_advances(superscript_digits, font_file) self.assertEqual(superscript_glyphs, numr_glyphs)
def test_superscript_digits(self): """Tests that 'numr' features maps digits to Unicode superscripts.""" ascii_digits = '0123456789' superscript_digits = u'⁰¹²³⁴⁵⁶⁷⁸⁹' for font_file in self.font_files: numr_glyphs = layout.get_advances( ascii_digits, font_file, '--features=numr') superscript_glyphs = layout.get_advances( superscript_digits, font_file) self.assertEqual(superscript_glyphs, numr_glyphs)
def test_individual_spacing_marks(self): """Tests that spacing marks are spacing by themselves.""" for font in self.font_files: print 'Testing %s for stand-alone spacing marks...' % font for mark in self.marks_to_test: mark = unichr(mark) advances = layout.get_advances(mark, font) assert len(advances) == 1 self.assertNotEqual(advances[0], 0)
def test_spacing_marks_in_combination(self): """Tests that spacing marks do not combine with base letters.""" for font in self.font_files: print 'Testing %s for spacing marks in combination...' % font for base_letter in (u'A\u00C6BCDEFGHIJKLMNO\u00D8\u01A0PRST' u'U\u01AFVWXYZ' u'a\u00E6bcdefghi\u0131j\u0237klmn' u'o\u00F8\u01A1prs\u017Ftu\u01B0vwxyz' u'\u03D2'): print 'Testing %s combinations' % base_letter for mark in self.marks_to_test: if mark == 0x02DE: # Skip rhotic hook, as it's perhaps OK for it to form # ligatures continue mark = unichr(mark) advances = layout.get_advances(base_letter + mark, font) self.assertEqual(len(advances), 2, 'The sequence <%04X, %04X> combines, ' 'but it should not' % (ord(base_letter), ord(mark)))
def test_spacing_marks_in_combination(self): """Tests that spacing marks do not combine with base letters.""" for font in self.font_files: print 'Testing %s for spacing marks in combination...' % font for base_letter in (u'A\u00C6BCDEFGHIJKLMNO\u00D8\u01A0PRST' u'U\u01AFVWXYZ' u'a\u00E6bcdefghi\u0131j\u0237klmn' u'o\u00F8\u01A1prs\u017Ftu\u01B0vwxyz' u'\u03D2'): print 'Testing %s combinations' % base_letter for mark in self.marks_to_test: if mark == 0x02DE: # Skip rhotic hook, as it's perhaps OK for it to form # ligatures continue mark = unichr(mark) advances = layout.get_advances(base_letter + mark, font) self.assertEqual( len(advances), 2, 'The sequence <%04X, %04X> combines, ' 'but it should not' % (ord(base_letter), ord(mark)))
def test_lack_of_ff_ligature(self): """Tests that the ff ligature is not formed by default.""" for fontfile in self.fontfiles: advances = layout.get_advances('ff', fontfile) self.assertEqual(len(advances), 2)