summaryrefslogtreecommitdiff
path: root/scripts/common_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/common_tests.py')
-rw-r--r--scripts/common_tests.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/common_tests.py b/scripts/common_tests.py
index 926652a..1b015b8 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."""
@@ -232,6 +245,15 @@ class TestLigatures(FontTest):
advances = layout.get_advances('ff', fontfile)
self.assertEqual(len(advances), 2)
+ def test_st_ligatures(self):
+ """Tests that st ligatures are formed by dlig."""
+ for fontfile in self.fontfiles:
+ for combination in [u'st', u'ſt']:
+ normal = layout.get_glyphs(combination, fontfile)
+ ligated = layout.get_glyphs(
+ combination, fontfile, '--features=dlig')
+ self.assertTrue(len(normal) == 2 and len(ligated) == 1)
+
class TestVerticalMetrics(FontTest):
"""Test the vertical metrics of fonts."""