Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self, anchorName, attachments, include, marksFilter=None, featureTag=None
):
attachments = list(self._iterAttachments(attachments, include, marksFilter))
if not attachments:
return
prefix = (featureTag + "_") if featureTag is not None else ""
lookupName = "%smark2mark_%s" % (prefix, anchorName)
filteringClass = self._makeMarkFilteringSetClass(
lookupName,
attachments,
markClass=self.context.markClasses[anchorName],
include=include,
)
lkp = ast.LookupBlock(lookupName)
lkp.statements.append(filteringClass)
lkp.statements.append(ast.makeLookupFlag(markFilteringSet=filteringClass))
lkp.statements.extend(pos.asAST() for pos in attachments)
return lkp
if not baseGlyphs:
return
ruleType = "mark" if isMkmk else "base"
statements = []
if isMkmk:
mkAttachMembers = list(markClass.glyphs)
mkAttachMembers.extend(
g[0] for g in baseGlyphs if g[0] not in mkAttachMembers
)
mkAttachCls = ast.makeGlyphClassDefinition(
lookupName + "MkAttach", mkAttachMembers
)
statements.append(mkAttachCls)
statements.append(ast.makeLookupFlag(markFilteringSet=mkAttachCls))
for baseName, x, y in baseGlyphs:
statements.append(
self._makeMarkPosRule(ruleType, baseName, x, y, markClass)
)
if statements:
lookup = ast.LookupBlock(lookupName)
lookup.statements.extend(statements)
return lookup
def _makeKerningLookup(
self, name, pairs, exclude=None, rtl=False, ignoreMarks=True
):
assert pairs
rules = []
for pair in pairs:
if exclude is not None and exclude(pair):
self.log.debug("pair excluded from '%s' lookup: %r", name, pair)
continue
rules.append(self._makePairPosRule(pair, rtl=rtl))
if rules:
lookup = ast.LookupBlock(name)
if ignoreMarks and self.options.ignoreMarks:
lookup.statements.append(ast.makeLookupFlag("IgnoreMarks"))
lookup.statements.extend(rules)
return lookup