Skip to content

Commit

Permalink
Handle spacing marks in a variable way
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Nov 13, 2023
1 parent e35dedb commit 87ae852
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/ufo2ft/featureWriters/kernFeatureWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ def _makePairPosRule(self, pair, side1Classes, side2Classes, rtl=False):
enumerated=enumerated,
)

def _filterSpacingMarks(self, marks):
return [mark for mark in marks if self.context.font[mark].width != 0]

def _makeKerningLookup(self, name, ignoreMarks=True):
lookup = ast.LookupBlock(name)
if ignoreMarks and self.options.ignoreMarks:
Expand All @@ -404,7 +407,7 @@ def _makeKerningLookup(self, name, ignoreMarks=True):

spacing = []
if marks:
spacing = [mark for mark in marks if self.context.font[mark].width != 0]
spacing = self._filterSpacingMarks(marks)
if not spacing:
# Simple case, there are no spacing ("Spacing Combining") marks,
# do what we've always done.
Expand Down
9 changes: 9 additions & 0 deletions Lib/ufo2ft/featureWriters/variableKernWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ def getKerningPairs(

return result

def _filterSpacingMarks(self, marks):
spacing = []
for mark in marks:
if all(
source.font[mark].width != 0 for source in self.context.font.sources
):
spacing.append(mark)
return spacing


def log_redefined_group(
side: str, name: str, group: tuple[str, ...], font: Any, members: set[str]
Expand Down

0 comments on commit 87ae852

Please sign in to comment.