Skip to content

Commit

Permalink
Merge pull request #964 from googlefonts/skip-ignorable-anchors
Browse files Browse the repository at this point in the history
markFeatureWriter: Skip ignorable anchors
  • Loading branch information
khaledhosny authored Nov 23, 2023
2 parents dc4354b + c5d975d commit 17aed70
Show file tree
Hide file tree
Showing 3 changed files with 434 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/glyphsLib/featureWriters/markFeatureWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ContextuallyAwareNamedAnchor(NamedAnchor):
"number",
"markClass",
"isContextual",
"isIgnorable",
"libData",
)

Expand Down Expand Up @@ -83,13 +84,15 @@ def parseAnchorName(
else:
isMark = False

return isMark, key, number, isContextual
isIgnorable = not key[0].isalpha()

return isMark, key, number, isContextual, isIgnorable

def __init__(self, name, x, y, markClass=None, libData=None):
self.name = name
self.x = x
self.y = y
isMark, key, number, isContextual = self.parseAnchorName(
isMark, key, number, isContextual, isIgnorable = self.parseAnchorName(
name,
markPrefix=self.markPrefix,
ligaSeparator=self.ligaSeparator,
Expand All @@ -106,6 +109,7 @@ def __init__(self, name, x, y, markClass=None, libData=None):
self.number = number
self.markClass = markClass
self.isContextual = isContextual
self.isIgnorable = isIgnorable
self.libData = libData


Expand Down Expand Up @@ -144,6 +148,8 @@ def _getAnchorLists(self):
a = self.NamedAnchor(name=anchorName, x=x, y=y, libData=libData)
if a.isContextual and not libData:
continue
if a.isIgnorable:
continue
anchorDict[anchorName] = a
if anchorDict:
result[glyphName] = list(anchorDict.values())
Expand Down
Loading

0 comments on commit 17aed70

Please sign in to comment.