diff options
author | James Godfrey-Kittle <jamesgk@google.com> | 2015-09-29 18:05:15 -0700 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-09-29 18:05:15 -0700 |
commit | 64a7750a219e522276a689c1771de1572bfc0372 (patch) | |
tree | d230bb0d28afd0dbf5f198a03246639031d87b5b /scripts/common_tests.py | |
parent | 24632ad9ef96131a86b5a099f2eb59888df1cc5f (diff) |
Move TestHints to common_tests
Diffstat (limited to 'scripts/common_tests.py')
-rw-r--r-- | scripts/common_tests.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py index dc24f38..e92e1c8 100644 --- a/scripts/common_tests.py +++ b/scripts/common_tests.py @@ -421,6 +421,38 @@ class TestVerticalMetrics(FontTest): self.expected_os2_usWinAscent) +class TestHints(FontTest): + """Tests hints.""" + + def setUp(self): + self.fontfiles, self.fonts = self.loaded_fonts + + def test_existance_of_hints(self): + """Tests all glyphs and makes sure non-composite ones have hints.""" + missing_hints = [] + for font in self.fonts: + glyf_table = font['glyf'] + for glyph_name in font.getGlyphOrder(): + glyph = glyf_table[glyph_name] + if glyph.numberOfContours <= 0: # composite or empty glyph + continue + if len(glyph.program.bytecode) <= 0: + missing_hints.append( + (glyph_name, font_data.font_name(font))) + + self.assertTrue(missing_hints == []) + + def test_height_of_lowercase_o(self): + """Tests the height of the lowercase o in low resolutions.""" + for fontfile in self.fontfiles: + for size in range(8, 30): # Kind of arbitrary + o_height = get_rendered_char_height( + fontfile, size, 'o') + n_height = get_rendered_char_height( + fontfile, size, 'n') + self.assertEqual(o_height, n_height) + + class TestGlyphAreas(unittest.TestCase): """Tests that glyph areas between weights have the right ratios.""" |