diff --git a/Lib/fontTools/subset/__init__.py b/Lib/fontTools/subset/__init__.py
index a41c48a4a..b4ff4063a 100644
--- a/Lib/fontTools/subset/__init__.py
+++ b/Lib/fontTools/subset/__init__.py
@@ -1675,6 +1675,16 @@ def subset_glyphs(self, s):
self.hdmx = {sz:_dict_subset(l, s.glyphs) for sz,l in self.hdmx.items()}
return bool(self.hdmx)
+@_add_method(ttLib.getTableClass('lcar'))
+def subset_glyphs(self, s):
+ table = self.table.LigatureCarets
+ if table.Format in (0, 1):
+ table.Carets = {glyph: table.Carets[glyph] for glyph in s.glyphs
+ if glyph in table.Carets}
+ return len(table.Carets) > 0
+ else:
+ assert False, "unknown 'lcar' format %s" % table.Format
+
@_add_method(ttLib.getTableClass('gvar'))
def prune_pre_subset(self, font, options):
if options.notdef_glyph and not options.notdef_outline:
diff --git a/Tests/subset/data/TestLCAR-0.ttx b/Tests/subset/data/TestLCAR-0.ttx
new file mode 100644
index 000000000..b9d6fc036
--- /dev/null
+++ b/Tests/subset/data/TestLCAR-0.ttx
@@ -0,0 +1,320 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TestLCAR
+
+
+ Regular
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/subset/data/TestLCAR-1.ttx b/Tests/subset/data/TestLCAR-1.ttx
new file mode 100644
index 000000000..6e8d85b64
--- /dev/null
+++ b/Tests/subset/data/TestLCAR-1.ttx
@@ -0,0 +1,320 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TestLCAR
+
+
+ Regular
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/subset/data/expect_lcar_0.ttx b/Tests/subset/data/expect_lcar_0.ttx
new file mode 100644
index 000000000..feb866d7f
--- /dev/null
+++ b/Tests/subset/data/expect_lcar_0.ttx
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/subset/data/expect_lcar_1.ttx b/Tests/subset/data/expect_lcar_1.ttx
new file mode 100644
index 000000000..26b500823
--- /dev/null
+++ b/Tests/subset/data/expect_lcar_1.ttx
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/subset/subset_test.py b/Tests/subset/subset_test.py
index c7818af54..82673bb29 100644
--- a/Tests/subset/subset_test.py
+++ b/Tests/subset/subset_test.py
@@ -116,6 +116,29 @@ class SubsetTest(unittest.TestCase):
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("expect_keep_gvar_notdef_outline.ttx"), ["GlyphOrder", "avar", "fvar", "gvar", "name"])
+ def test_subset_lcar_remove(self):
+ _, fontpath = self.compile_font(self.getpath("TestLCAR-0.ttx"), ".ttf")
+ subsetpath = self.temp_path(".ttf")
+ subset.main([fontpath, "--glyphs=one", "--output-file=%s" % subsetpath])
+ subsetfont = TTFont(subsetpath)
+ self.assertNotIn("lcar", subsetfont)
+
+ def test_subset_lcar_format_0(self):
+ _, fontpath = self.compile_font(self.getpath("TestLCAR-0.ttx"), ".ttf")
+ subsetpath = self.temp_path(".ttf")
+ subset.main([fontpath, "--unicodes=U+FB01",
+ "--output-file=%s" % subsetpath])
+ subsetfont = TTFont(subsetpath)
+ self.expect_ttx(subsetfont, self.getpath("expect_lcar_0.ttx"), ["lcar"])
+
+ def test_subset_lcar_format_1(self):
+ _, fontpath = self.compile_font(self.getpath("TestLCAR-1.ttx"), ".ttf")
+ subsetpath = self.temp_path(".ttf")
+ subset.main([fontpath, "--unicodes=U+FB01",
+ "--output-file=%s" % subsetpath])
+ subsetfont = TTFont(subsetpath)
+ self.expect_ttx(subsetfont, self.getpath("expect_lcar_1.ttx"), ["lcar"])
+
def test_subset_math(self):
_, fontpath = self.compile_font(self.getpath("TestMATH-Regular.ttx"), ".ttf")
subsetpath = self.temp_path(".ttf")