diff --git a/tests/data/SourceSansPro-Regular.otf b/tests/data/SourceSansPro-Regular.otf new file mode 100644 index 0000000..279e691 Binary files /dev/null and b/tests/data/SourceSansPro-Regular.otf differ diff --git a/tests/test_uharfbuzz.py b/tests/test_uharfbuzz.py index 0b16457..f5b47c5 100644 --- a/tests/test_uharfbuzz.py +++ b/tests/test_uharfbuzz.py @@ -8,6 +8,7 @@ TESTDATA = Path(__file__).parent / "data" ADOBE_BLANK_TTF_PATH = TESTDATA / "AdobeBlank.subset.ttf" OPEN_SANS_TTF_PATH = TESTDATA / "OpenSans.subset.ttf" +SOURCE_SANS_PRO_OTF_PATH = TESTDATA / "SourceSansPro-Regular.otf" MUTATOR_SANS_TTF_PATH = TESTDATA / "MutatorSans-VF.subset.ttf" SPARSE_FONT_TTF_PATH = TESTDATA / "SparseFont.ttf" MATH_FONT_TTF_PATH = TESTDATA / "STIXTwoMath-Regular.ttf" @@ -34,6 +35,15 @@ def blankfont(): return font +@pytest.fixture +def sourcesance(): + """Returns the full Source sans Pro Regular font.""" + blob = hb.Blob.from_file_path(SOURCE_SANS_PRO_OTF_PATH) + face = hb.Face(blob) + font = hb.Font(face) + return font + + @pytest.fixture def opensans(): """Return a subset of OpenSans.ttf containing the following glyphs/characters: @@ -872,6 +882,14 @@ def test_ot_layout_script_get_language_tags(self, blankfont): assert tags == [] +class TestGetAlternates: + def test_ot_layout_lookup_get_glyph_alternates(self, sourcesance): + alternate_glyphs = hb.ot_layout_lookup_get_glyph_alternates( + sourcesance.face, 1, 1091 + ) + assert alternate_glyphs == [1549, 1620, 1606, 1578, 1592, 1103, 1115] + + class TestOTMath: def test_ot_math_has_data(self, mathfont): assert hb.ot_math_has_data(mathfont.face)