blob: 0785b4e78ef8fbc1ab617d32a7a2370c46749847 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/python
"""Test general health of the fonts."""
import glob
import unittest
from fontTools import ttLib
from nototools import font_data
def load_fonts():
"""Load all major fonts."""
all_font_files = (glob.glob('out/RobotoTTF/*.ttf')
+ glob.glob('out/RobotoCondensedTTF/*.ttf'))
all_fonts = [ttLib.TTFont(font) for font in all_font_files]
assert len(all_font_files) == 18
return all_font_files, all_fonts
class TestItalicAngle(unittest.TestCase):
"""Test the italic angle of fonts."""
def setUp(self):
_, self.fonts = load_fonts()
def test_italic_angle(self):
"""Tests the italic angle of fonts to be correct."""
for font in self.fonts:
post_table = font['post']
if 'Italic' in font_data.font_name(font):
expected_angle = -12.0
else:
expected_angle = 0.0
self.assertEqual(post_table.italicAngle, expected_angle)
if __name__ == '__main__':
unittest.main()
|