diff options
author | James Godfrey-Kittle <jamesgk19@gmail.com> | 2015-10-06 09:47:56 -0700 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk19@gmail.com> | 2015-10-06 09:47:56 -0700 |
commit | 92bd6f2335936dfdc09aa13bf26591cce066472b (patch) | |
tree | 78cf7ac665bad07a749bc09bec3e669be6fdcb35 /scripts | |
parent | 74bdf5953a7c20cdca0442e1b70a2d3b24072d01 (diff) | |
parent | 5bd6d2475816d8f2220ed44d4f503a051e06e0a4 (diff) |
Merge pull request #114 from jamesgk/meta-fix
Provide a hotfix for webfont names
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/touchup_for_web.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/touchup_for_web.py b/scripts/touchup_for_web.py index c4f75c1..3e29e58 100755 --- a/scripts/touchup_for_web.py +++ b/scripts/touchup_for_web.py @@ -47,9 +47,21 @@ def apply_web_specific_fixes(font, family_name): family_name += ' Condensed' full_name = family_name + ' ' + subfamily_name - # Family name - font_data.set_name_record(font, 1, family_name) + # macStyle + bold = subfamily_name.startswith(('Bold', 'Black')) + italic = subfamily_name.endswith('Italic') + macStyle = (italic << 1) | bold + font['head'].macStyle = macStyle + + # Family, subfamily names font_data.set_name_record(font, 16, family_name) + style_map = ['Regular', 'Bold', 'Italic', 'Bold Italic'] + if subfamily_name in style_map: + font_data.set_name_record(font, 1, family_name) + else: + weight = subfamily_name.split()[0] + font_data.set_name_record(font, 1, '%s %s' % (family_name, weight)) + font_data.set_name_record(font, 2, style_map[macStyle]) # Unique identifier and full name font_data.set_name_record(font, 3, full_name) |