Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Don't skip over spacing marks when kerning (#720)" #722

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions Lib/ufo2ft/featureWriters/kernFeatureWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,25 +361,7 @@ def _makePairPosRule(self, pair, side1Classes, side2Classes, rtl=False):
def _makeKerningLookup(self, name, ignoreMarks=True):
lookup = ast.LookupBlock(name)
if ignoreMarks and self.options.ignoreMarks:
# We only want to filter the spacing marks
marks = self.context.gdefClasses.mark
spacing = []
if marks:
spacing = [mark for mark in marks if self.context.font[mark].width != 0]
if not spacing:
# Simple case, there are no spacing ("Spacing Combining") marks,
# do what we've always done.
lookup.statements.append(ast.makeLookupFlag("IgnoreMarks"))
else:
# We want spacing marks to block kerns.
className = "MFS_%s" % name
filteringClass = ast.makeGlyphClassDefinitions(
{className: spacing}, feaFile=self.context.feaFile
)[className]
lookup.statements.append(filteringClass)
lookup.statements.append(
ast.makeLookupFlag(markFilteringSet=filteringClass)
)
lookup.statements.append(ast.makeLookupFlag("IgnoreMarks"))
return lookup

def knownScriptsPerCodepoint(self, uv: int) -> set[str]:
Expand Down
52 changes: 0 additions & 52 deletions tests/data/SpacingCombiningTest-Regular.ufo/fontinfo.plist

This file was deleted.

14 changes: 0 additions & 14 deletions tests/data/SpacingCombiningTest-Regular.ufo/glyphs/contents.plist

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions tests/data/SpacingCombiningTest-Regular.ufo/glyphs/ka-deva.glif

This file was deleted.

19 changes: 0 additions & 19 deletions tests/data/SpacingCombiningTest-Regular.ufo/glyphs/layerinfo.plist

This file was deleted.

18 changes: 0 additions & 18 deletions tests/data/SpacingCombiningTest-Regular.ufo/glyphs/ra-deva.glif

This file was deleted.

7 changes: 0 additions & 7 deletions tests/data/SpacingCombiningTest-Regular.ufo/glyphs/space.glif

This file was deleted.

23 changes: 0 additions & 23 deletions tests/data/SpacingCombiningTest-Regular.ufo/kerning.plist

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/SpacingCombiningTest-Regular.ufo/layercontents.plist

This file was deleted.

76 changes: 0 additions & 76 deletions tests/data/SpacingCombiningTest-Regular.ufo/lib.plist

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/SpacingCombiningTest-Regular.ufo/metainfo.plist

This file was deleted.

34 changes: 0 additions & 34 deletions tests/featureWriters/kernFeatureWriter_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os
from textwrap import dedent

import pytest
Expand Down Expand Up @@ -1260,39 +1259,6 @@ def test_quantize(self, FontClass):
"""
)

def test_skip_spacing_marks(self, FontClass):
dirname = os.path.dirname(os.path.dirname(__file__))
fontPath = os.path.join(dirname, "data", "SpacingCombiningTest-Regular.ufo")
testufo = FontClass(fontPath)
generated = self.writeFeatures(testufo)
assert dedent(str(generated)) == dedent(
"""\
lookup kern_Deva {
@MFS_kern_Deva = [highspacingdot-deva];
lookupflag UseMarkFilteringSet @MFS_kern_Deva;
pos ka-deva ra-deva -250;
pos ra-deva ka-deva -250;
} kern_Deva;

lookup kern_Deva_marks {
pos highspacingdot-deva ka-deva -200;
pos ka-deva highspacingdot-deva -150;
} kern_Deva_marks;

feature dist {
script dev2;
language dflt;
lookup kern_Deva;
lookup kern_Deva_marks;

script deva;
language dflt;
lookup kern_Deva;
lookup kern_Deva_marks;
} dist;
"""
)


def test_kern_split_multi_glyph_class(FontClass):
glyphs = {
Expand Down