[subset] Fix lint.

This commit is contained in:
Garret Rieger 2024-10-24 00:30:38 +00:00
parent edaab1fa2f
commit 201f02c2c2
2 changed files with 14 additions and 6 deletions

View File

@ -2929,7 +2929,8 @@ def subset_glyphs(self, s):
for u, g in l for u, g in l
if g in s.glyphs_requested or u in s.unicodes_requested if g in s.glyphs_requested or u in s.unicodes_requested
] ]
for v, l in t.uvsDict.items() if v in s.unicodes_requested for v, l in t.uvsDict.items()
if v in s.unicodes_requested
} }
t.uvsDict = {v: l for v, l in t.uvsDict.items() if l} t.uvsDict = {v: l for v, l in t.uvsDict.items() if l}
elif t.isUnicode(): elif t.isUnicode():

View File

@ -938,7 +938,6 @@ class SubsetTest:
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("CmapSubsetTest.subset.ttx"), ["cmap"]) self.expect_ttx(subsetfont, self.getpath("CmapSubsetTest.subset.ttx"), ["cmap"])
def test_cmap_format14(self): def test_cmap_format14(self):
fontpath = self.compile_font(self.getpath("cmap14_font1.ttx"), ".otf") fontpath = self.compile_font(self.getpath("cmap14_font1.ttx"), ".otf")
subsetpath = self.temp_path(".otf") subsetpath = self.temp_path(".otf")
@ -947,17 +946,25 @@ class SubsetTest:
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.no_uvs.ttx"), ["cmap"]) self.expect_ttx(subsetfont, self.getpath("cmap14_font1.no_uvs.ttx"), ["cmap"])
subset.main([fontpath, "--unicodes=4e05,e0100", "--output-file=%s" % subsetpath]) subset.main(
[fontpath, "--unicodes=4e05,e0100", "--output-file=%s" % subsetpath]
)
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.uvs.ttx"), ["cmap"]) self.expect_ttx(subsetfont, self.getpath("cmap14_font1.uvs.ttx"), ["cmap"])
subset.main([fontpath, "--unicodes=4e10", "--output-file=%s" % subsetpath]) subset.main([fontpath, "--unicodes=4e10", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.no_uvs_non_default.ttx"), ["cmap"]) self.expect_ttx(
subsetfont, self.getpath("cmap14_font1.no_uvs_non_default.ttx"), ["cmap"]
)
subset.main([fontpath, "--unicodes=4e10,e0100", "--output-file=%s" % subsetpath]) subset.main(
[fontpath, "--unicodes=4e10,e0100", "--output-file=%s" % subsetpath]
)
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.uvs_non_default.ttx"), ["cmap"]) self.expect_ttx(
subsetfont, self.getpath("cmap14_font1.uvs_non_default.ttx"), ["cmap"]
)
@pytest.mark.parametrize("text, n", [("!", 1), ("#", 2)]) @pytest.mark.parametrize("text, n", [("!", 1), ("#", 2)])
def test_GPOS_PairPos_Format2_useClass0(self, text, n): def test_GPOS_PairPos_Format2_useClass0(self, text, n):