diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2016-07-27 13:08:37 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2016-07-27 13:10:24 -0700 |
commit | bac1aec6354cc1766cf4ff03578d32d0fa623cb0 (patch) | |
tree | 0e90488fdcdb0c3843b4075a849ce178c31cc189 /tools/fonts | |
parent | d67c142aef930bfbcf00e0367f23dafcf373b091 (diff) |
Test Roboto's vertical font metrics
Test that yMin, yMax, Ascent, and Descent values of Roboto are not
changed.
Bug: 26187231
Change-Id: Ia41f5a118e292b8eda8dae5124be112dc0cdbc8d
Diffstat (limited to 'tools/fonts')
-rwxr-xr-x | tools/fonts/fontchain_lint.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/fonts/fontchain_lint.py b/tools/fonts/fontchain_lint.py index 336fce96650f..b6f46a2423ae 100755 --- a/tools/fonts/fontchain_lint.py +++ b/tools/fonts/fontchain_lint.py @@ -554,6 +554,15 @@ def compute_expected_emoji(): return all_emoji, default_emoji, equivalent_emoji +def check_vertical_metrics(): + for record in _fallback_chain: + if record.name in ['sans-serif', 'sans-serif-condensed']: + font = open_font(record.font) + assert (font['head'].yMax == 2163 and font['head'].yMin == -555 and + font['hhea'].ascent == 1900 and font['hhea'].descent == -500), ( + 'Vertical metrics of %s do not match expected Roboto metrics.' % (record.font,)) + + def main(): global _fonts_dir target_out = sys.argv[1] @@ -562,6 +571,8 @@ def main(): fonts_xml_path = path.join(target_out, 'etc', 'fonts.xml') parse_fonts_xml(fonts_xml_path) + check_vertical_metrics() + hyphens_dir = path.join(target_out, 'usr', 'hyphen-data') check_hyphens(hyphens_dir) |