From 1acf2d34ecec49da32145fabd3ef808f4abd6f92 Mon Sep 17 00:00:00 2001 From: typoman Date: Mon, 24 Oct 2022 18:23:45 +0200 Subject: [PATCH 1/2] Make it possible to have custom name for anchors in cursFeatureWriter. --- Lib/ufo2ft/featureWriters/cursFeatureWriter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/ufo2ft/featureWriters/cursFeatureWriter.py b/Lib/ufo2ft/featureWriters/cursFeatureWriter.py index 477a6b026..b5a5c6af9 100644 --- a/Lib/ufo2ft/featureWriters/cursFeatureWriter.py +++ b/Lib/ufo2ft/featureWriters/cursFeatureWriter.py @@ -19,6 +19,8 @@ class CursFeatureWriter(BaseFeatureWriter): tableTag = "GPOS" features = frozenset(["curs"]) + entry = "entry" + exit = "exit" def _makeCursiveFeature(self): cmap = self.makeUnicodeToGlyphNameMapping() @@ -97,9 +99,9 @@ def _makeCursiveStatements(self, glyphs): for anchor in glyph.anchors: if entryAnchor and exitAnchor: break - if anchor.name == "entry": + if anchor.name == self.entry: entryAnchor = ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)) - elif anchor.name == "exit": + elif anchor.name == self.exit: exitAnchor = ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)) # A glyph can have only one of the cursive anchors (e.g. if it From bae42badc0aa35cd316911a88a0ec4f49917543e Mon Sep 17 00:00:00 2001 From: typoman Date: Mon, 31 Oct 2022 19:09:54 +0100 Subject: [PATCH 2/2] Use options dict for anchor names in cursFeatureWriter. --- Lib/ufo2ft/featureWriters/cursFeatureWriter.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/ufo2ft/featureWriters/cursFeatureWriter.py b/Lib/ufo2ft/featureWriters/cursFeatureWriter.py index b5a5c6af9..02ba08a25 100644 --- a/Lib/ufo2ft/featureWriters/cursFeatureWriter.py +++ b/Lib/ufo2ft/featureWriters/cursFeatureWriter.py @@ -19,8 +19,7 @@ class CursFeatureWriter(BaseFeatureWriter): tableTag = "GPOS" features = frozenset(["curs"]) - entry = "entry" - exit = "exit" + options = dict(entry="entry", exit="exit") def _makeCursiveFeature(self): cmap = self.makeUnicodeToGlyphNameMapping() @@ -99,9 +98,9 @@ def _makeCursiveStatements(self, glyphs): for anchor in glyph.anchors: if entryAnchor and exitAnchor: break - if anchor.name == self.entry: + if anchor.name == self.options.entry: entryAnchor = ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)) - elif anchor.name == self.exit: + elif anchor.name == self.options.exit: exitAnchor = ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)) # A glyph can have only one of the cursive anchors (e.g. if it