summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRoozbeh Pournader <roozbeh@google.com>2015-04-25 18:29:41 -0700
committerRoozbeh Pournader <roozbeh@google.com>2015-04-25 18:29:41 -0700
commitbde0bbc0c82b56ede1ebc7e7c67091a2276548ea (patch)
tree1f5bffca269f55a0f398ce0bc5504a079d4ab49a /scripts
parent537c5d34214626d6300c5b7ea6df9b0be89f0188 (diff)
Test 'numr' and superscript digits to have the same width.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/common_tests.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py
index 926652a..07b41b1 100644
--- a/scripts/common_tests.py
+++ b/scripts/common_tests.py
@@ -1,3 +1,5 @@
+# coding=UTF-8
+#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -167,7 +169,7 @@ class TestDigitWidths(FontTest):
"""Tests the width of digits."""
def setUp(self):
- _, self.fonts = self.loaded_fonts
+ self.font_files, self.fonts = self.loaded_fonts
self.digits = [
'zero', 'one', 'two', 'three', 'four',
'five', 'six', 'seven', 'eight', 'nine']
@@ -179,6 +181,17 @@ class TestDigitWidths(FontTest):
widths = [hmtx_table[digit][0] for digit in self.digits]
self.assertEqual(len(set(widths)), 1)
+ def test_superscript_digits(self):
+ """Tests that 'numr' features maps digits to Unicode superscripts."""
+ ascii_digits = '0123456789'
+ superscript_digits = u'⁰¹²³⁴⁵⁶⁷⁸⁹'
+ for font_file in self.font_files:
+ numr_glyphs = layout.get_advances(
+ ascii_digits, font_file, '--features=numr')
+ superscript_glyphs = layout.get_advances(
+ superscript_digits, font_file)
+ self.assertEqual(superscript_glyphs, numr_glyphs)
+
class TestCharacterCoverage(FontTest):
"""Tests character coverage."""