diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-01-06 23:05:29 -0800 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-16 12:16:24 -0700 |
commit | 3c963abcf66d44c1587376e7d245b889ae62401a (patch) | |
tree | 3c37ad64eda098c72e88e28fabda64b4968659a2 /scripts/roboto_data.py | |
parent | 26c0c6588b8bae5df35c9c968d0e088b5cc37ef6 (diff) |
Update Android touchup and test tools for latest delivery.
Touchup:
- Shared touchups between Android and web are moved to a new module
- OS/2.usWeightClass is fixed to match the font name
- Unassigned characters are no longer explicitly dropped
Testing:
- Rhotic hook is skipped when checking that spacing marks don't form
ligatures
- OS/2.usWeightClass is tested to be set correctly
Diffstat (limited to 'scripts/roboto_data.py')
-rw-r--r-- | scripts/roboto_data.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/roboto_data.py b/scripts/roboto_data.py new file mode 100644 index 0000000..ef2a773 --- /dev/null +++ b/scripts/roboto_data.py @@ -0,0 +1,27 @@ +#!/usr/bin/python +"""Post-build changes for Roboto for Android.""" + +import re + +WEIGHTS = { + 'Thin': 250, + 'Light': 300, + 'Regular': 400, + 'Medium': 500, + 'Bold': 700, + 'Black': 900, +} + +_ALL_WEIGHTS_RE = re.compile( + '(' + '|'.join(WEIGHTS.keys()) + ')' +) + + +def extract_weight_name(font_name): + """Extracts the weight part of the name from a font name.""" + match = re.search(_ALL_WEIGHTS_RE, font_name) + if match is None: + assert font_name in ['Roboto Italic', 'Roboto Condensed Italic'] + return 'Regular' + else: + return match.group(1) |