From a7913ef50eb17903f57528decce15f10bdebf7d0 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 22 Feb 2021 11:31:48 +0000 Subject: [PATCH] Add test for Regular fallback --- Tests/varLib/instancer/names_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/varLib/instancer/names_test.py b/Tests/varLib/instancer/names_test.py index 27446e373..ae8e4caaf 100644 --- a/Tests/varLib/instancer/names_test.py +++ b/Tests/varLib/instancer/names_test.py @@ -305,3 +305,14 @@ def test_updateNameTable_elided_axisValues(varfont): # the subFamilyName set so it conforms to the RIBBI model. expected = {(2, 3, 1, 0x409): "Regular", (17, 3, 1, 0x409): "Black"} _test_name_records(varfont, expected, isNonRIBBI=True) + + +def test_updateNameTable_existing_subfamily_name_is_not_regular(varfont): + # Check the subFamily name will be set to Regular when we update a name + # table to a non-RIBBI style and the current subFamily name is a RIBBI + # style which isn't Regular. + varfont["name"].setName("Bold", 2, 3, 1, 0x409) # subFamily Regular --> Bold + + instancer.names.updateNameTable(varfont, {"wght": 100}) + expected = {(2, 3, 1, 0x409): "Regular", (17, 3, 1, 0x409): "Thin"} + _test_name_records(varfont, expected, isNonRIBBI=True)