diff --git a/src/diffenator2/font.py b/src/diffenator2/font.py index 0f61eff..7ba5e46 100644 --- a/src/diffenator2/font.py +++ b/src/diffenator2/font.py @@ -138,7 +138,7 @@ def instances(self): name.getBestSubFamilyName(), ) ) - return sorted(results, key=lambda k: k.coords["wght"]) + return results def masters(self): assert self.is_variable(), "Needs to be a variable font" diff --git a/tests/__init__.py b/tests/__init__.py index 86a3068..c893fd3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -9,4 +9,5 @@ mavenpro_regular = os.path.join(DATA_FP, "MavenPro-Regular.subset.ttf") mavenpro_extra_bold = os.path.join(DATA_FP, "MavenPro-ExtraBold.subset.ttf") mavenpro_black = os.path.join(DATA_FP, "MavenPro-Black.subset.ttf") -commissioner_vf = os.path.join(DATA_FP, "Commissioner[FLAR,VOLM,slnt,wght].ttf") \ No newline at end of file +commissioner_vf = os.path.join(DATA_FP, "Commissioner[FLAR,VOLM,slnt,wght].ttf") +kablammo_vf = os.path.join(DATA_FP, "Kablammo[MORF].ttf") \ No newline at end of file diff --git a/tests/data/Kablammo[MORF].ttf b/tests/data/Kablammo[MORF].ttf new file mode 100644 index 0000000..87c31df Binary files /dev/null and b/tests/data/Kablammo[MORF].ttf differ diff --git a/tests/test_font.py b/tests/test_font.py index 938504e..adc1e96 100644 --- a/tests/test_font.py +++ b/tests/test_font.py @@ -64,11 +64,34 @@ def test_match_coordinates(fp_before, fp_after, expected): }, ] ), + ( + kablammo_vf, + [ + { + "name": "Zoink", + "coords": {"MORF": 0.0}, + }, + { + "name": "Bloop", + "coords": {'MORF': 20.0}, + }, + { + "name": "Splat", + "coords": {'MORF': 40.0}, + }, + { + "name": "Eek", + "coords": {'MORF': 60.0}, + }, + + ] + ) ] ) def test_instances(fp, expected): font = DFont(fp) font_instances = font.instances() + assert len(font_instances) == len(expected) for got, want in zip(font_instances, expected): assert got.font == font assert got.name == want["name"]