summaryrefslogtreecommitdiff
path: root/scripts/touchup_for_android.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/touchup_for_android.py')
-rwxr-xr-xscripts/touchup_for_android.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/touchup_for_android.py b/scripts/touchup_for_android.py
index 187a432..e13adea 100755
--- a/scripts/touchup_for_android.py
+++ b/scripts/touchup_for_android.py
@@ -56,7 +56,7 @@ def apply_android_specific_fixes(font):
hhea.lineGap = 0
# Remove combining keycap and the arrows from the cmap table:
- # https://code.google.com/a/google.com/p/roboto/issues/detail?id=52
+ # https://github.com/google/roboto/issues/99
font_data.delete_from_cmap(font, [
0x20E3, # COMBINING ENCLOSING KEYCAP
0x2191, # UPWARDS ARROW
@@ -68,6 +68,18 @@ def apply_android_specific_fixes(font):
if table in font:
del font[table]
+ # Set bold bits for Black (macStyle bit 0, fsSelection bit 5, subfamily)
+ name_records = font_data.get_name_records(font)
+ family_name = name_records[1]
+ subfam_name = name_records[2]
+ if family_name.endswith('Black'):
+ font['head'].macStyle |= (1 << 0)
+ font['OS/2'].fsSelection |= (1 << 5)
+ font['OS/2'].fsSelection &= ~(1 << 6)
+ new_subfam_name = (
+ ('Bold ' + subfam_name) if subfam_name != 'Regular' else 'Bold')
+ font_data.set_name_record(font, 2, new_subfam_name)
+
def correct_font(source_font_name, target_font_name):
"""Corrects metrics and other meta information."""