diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-01-13 10:00:04 -0800 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-16 12:16:25 -0700 |
commit | d5d62b219ca099784b732927035e37a2470c5c04 (patch) | |
tree | c662d49ffd429bf3d9c24dd92395f55714afe4bf /scripts | |
parent | 29257870e8eb50be42c0e36f70c88817c0a9ce50 (diff) |
Fix name table overrides for condensed fonts.
Fixes issue 104 and issue 105.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/common_tests.py | 5 | ||||
-rwxr-xr-x | scripts/run_web_tests.py | 2 | ||||
-rwxr-xr-x | scripts/touchup_for_web.py | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py index e766487..9e6f4c7 100644 --- a/scripts/common_tests.py +++ b/scripts/common_tests.py @@ -145,6 +145,11 @@ class TestNames(FontTest): if 16 in records: self.assertEqual(records[16], records[1]) + def test_postscript_name_for_spaces(self): + """Tests that there are no spaces in PostScript names.""" + for records in self.names: + self.assertFalse(' ' in records[6]) + class TestDigitWidths(FontTest): """Tests the width of digits.""" diff --git a/scripts/run_web_tests.py b/scripts/run_web_tests.py index fbeee0a..3bcfd97 100755 --- a/scripts/run_web_tests.py +++ b/scripts/run_web_tests.py @@ -37,7 +37,7 @@ class TestNames(common_tests.TestNames): def test_postscript_name(self): """Tests the postscript name.""" for records in self.names: - expected_name = records[1] + '-' + records[2].replace(' ', '') + expected_name = (records[1] + '-' + records[2]).replace(' ', '') self.assertEqual(records[6], expected_name) diff --git a/scripts/touchup_for_web.py b/scripts/touchup_for_web.py index 8760394..628374a 100755 --- a/scripts/touchup_for_web.py +++ b/scripts/touchup_for_web.py @@ -27,6 +27,9 @@ def apply_web_specific_fixes(font, family_name): 'Medium', 'Medium Italic', 'Bold', 'Bold Italic', 'Black', 'Black Italic']) + + if 'Condensed' in font_data.get_name_records(font)[1]: + family_name += ' Condensed' full_name = family_name + ' ' + subfamily_name # Family name @@ -40,7 +43,7 @@ def apply_web_specific_fixes(font, family_name): # PostScript name font_data.set_name_record( - font, 6, family_name+'-'+subfamily_name.replace(' ', '')) + font, 6, (family_name+'-'+subfamily_name).replace(' ', '')) def correct_font(source_font_name, target_font_name, family_name): |