diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-01-08 11:39:29 -0800 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-16 12:16:25 -0700 |
commit | 14eecc2ca439557e4183722e07dab0308f3f18fe (patch) | |
tree | 261ccab359d4e889c501cf83e80e6db6f061e014 | |
parent | cfa5c8e378eb1913c447236aab739febe2c6cc5d (diff) |
Don't update font version in web target.
This is because web targets are from different cuts, and we want to
keep the information.
-rw-r--r-- | scripts/roboto_data.py | 2 | ||||
-rwxr-xr-x | scripts/run_web_tests.py | 7 | ||||
-rw-r--r-- | scripts/temporary_touchups.py | 16 | ||||
-rwxr-xr-x | scripts/touchup_for_android.py | 1 |
4 files changed, 18 insertions, 8 deletions
diff --git a/scripts/roboto_data.py b/scripts/roboto_data.py index 38d4d0c..922c464 100644 --- a/scripts/roboto_data.py +++ b/scripts/roboto_data.py @@ -23,7 +23,7 @@ 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'] + assert re.match('^Roboto(Draft)?( Condensed)? Italic$', font_name) return 'Regular' else: return match.group(1) diff --git a/scripts/run_web_tests.py b/scripts/run_web_tests.py index 2fc55e8..9309e0b 100755 --- a/scripts/run_web_tests.py +++ b/scripts/run_web_tests.py @@ -30,6 +30,13 @@ class TestVerticalMetrics(common_tests.TestVerticalMetrics): self.assertEqual(os2_table.usWinAscent, 1946) +class TestMetaInfo(common_tests.TestMetaInfo): + loaded_fonts = FONTS + # Since different font files are hinted at different times, the actual + # outlines differ slightly. So we are keeping the version numbers as a hint. + test_version_numbers = None + + class TestNames(common_tests.TestNames): loaded_fonts = FONTS family_name = 'RobotoDraft' diff --git a/scripts/temporary_touchups.py b/scripts/temporary_touchups.py index 22397e7..e284f37 100644 --- a/scripts/temporary_touchups.py +++ b/scripts/temporary_touchups.py @@ -13,13 +13,6 @@ def apply_temporary_fixes(font): weight_number = roboto_data.WEIGHTS[weight] font['OS/2'].usWeightClass = weight_number - # Update version and revision numbers from buildnumber.txt - build_number = roboto_data.get_build_number() - version_number = '2.' + build_number - version_record = 'Version %s; %d' % (version_number, date.today().year) - font_data.set_name_record(font, 5, version_record) - font['head'].fontRevision = float(version_number) - # Set ascent, descent, and lineGap values to Android K values hhea = font['hhea'] hhea.ascent = 1900 @@ -30,3 +23,12 @@ def apply_temporary_fixes(font): font_data.set_name_record( font, 0, 'Copyright 2011 Google Inc. All Rights Reserved.') + +def update_version_and_revision(font): + """Update version and revision numbers from buildnumber.txt.""" + build_number = roboto_data.get_build_number() + version_number = '2.' + build_number + version_record = 'Version %s; %d' % (version_number, date.today().year) + font_data.set_name_record(font, 5, version_record) + font['head'].fontRevision = float(version_number) + diff --git a/scripts/touchup_for_android.py b/scripts/touchup_for_android.py index d811303..c67d048 100755 --- a/scripts/touchup_for_android.py +++ b/scripts/touchup_for_android.py @@ -35,6 +35,7 @@ def correct_font(source_font_name, target_font_name): """Corrects metrics and other meta information.""" font = ttLib.TTFont(source_font_name) temporary_touchups.apply_temporary_fixes(font) + temporary_touchups.update_version_and_revision(font) apply_android_specific_fixes(font) font.save(target_font_name) |