[subset] Add tests for UVS + cmap14 subsetting.

This commit is contained in:
Garret Rieger 2024-10-23 22:07:34 +00:00
parent 4a38610072
commit edaab1fa2f
6 changed files with 1172 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x4e05" name="g15"/><!-- CJK UNIFIED IDEOGRAPH-4E05 -->
</cmap_format_4>
</cmap>
</ttFont>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x4e10" name="g20"/><!-- CJK UNIFIED IDEOGRAPH-4E10 -->
</cmap_format_4>
</cmap>
</ttFont>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<cmap>
<tableVersion version="0"/>
<cmap_format_14 platformID="0" platEncID="5">
<map uv="0x4e05" uvs="0xe0100"/>
</cmap_format_14>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x4e05" name="g15"/><!-- CJK UNIFIED IDEOGRAPH-4E05 -->
</cmap_format_4>
</cmap>
</ttFont>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<cmap>
<tableVersion version="0"/>
<cmap_format_14 platformID="0" platEncID="5">
<map uv="0x4e10" uvs="0xe0100" name="g25"/>
</cmap_format_14>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x4e10" name="g20"/><!-- CJK UNIFIED IDEOGRAPH-4E10 -->
</cmap_format_4>
</cmap>
</ttFont>

View File

@ -938,6 +938,27 @@ class SubsetTest:
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("CmapSubsetTest.subset.ttx"), ["cmap"])
def test_cmap_format14(self):
fontpath = self.compile_font(self.getpath("cmap14_font1.ttx"), ".otf")
subsetpath = self.temp_path(".otf")
subset.main([fontpath, "--unicodes=4e05", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.no_uvs.ttx"), ["cmap"])
subset.main([fontpath, "--unicodes=4e05,e0100", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.uvs.ttx"), ["cmap"])
subset.main([fontpath, "--unicodes=4e10", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.no_uvs_non_default.ttx"), ["cmap"])
subset.main([fontpath, "--unicodes=4e10,e0100", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("cmap14_font1.uvs_non_default.ttx"), ["cmap"])
@pytest.mark.parametrize("text, n", [("!", 1), ("#", 2)])
def test_GPOS_PairPos_Format2_useClass0(self, text, n):
# Check two things related to class 0 ('every other glyph'):