Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
used.add(className)
if not isMkmk:
ligaAnchors = self.context.ligaAnchorList
for i, (anchorName, accentAnchorName) in enumerate(ligaAnchors, 1):
className = self._generateClassName(accentAnchorName)
markClass = markClasses[className]
lookup = self._makeMarkToLigaLookup(
"mark2liga%d" % i, anchorName, accentAnchorName, markClass
)
if lookup:
lookups.append(lookup)
used.add(className)
if lookups:
feature = ast.FeatureBlock(featureName)
feature.statements.extend(lookups)
return feature
def _makeMarkFeature(self, include):
baseLkp = self._makeMarkLookup(
"mark2base", self.context.markToBaseAttachments, include
)
ligaLkp = self._makeMarkLookup(
"mark2liga", self.context.markToLigaAttachments, include
)
if baseLkp is None and ligaLkp is None:
return
feature = ast.FeatureBlock("mark")
if baseLkp:
feature.statements.append(baseLkp)
if ligaLkp:
feature.statements.append(ligaLkp)
return feature
self.context.markToMarkAttachments.items()
):
lkp = self._makeMarkToMarkLookup(
anchorName,
attachments,
include=include,
marksFilter=marksFilter,
featureTag=tag,
)
if lkp is not None:
mkmkLookups.append(lkp)
if not any([baseLkp, ligaLkp, mkmkLookups]):
return
feature = ast.FeatureBlock(tag)
if baseLkp:
feature.statements.append(baseLkp)
if ligaLkp:
feature.statements.append(ligaLkp)
feature.statements.extend(mkmkLookups)
return feature
def _makeFeatureBlocks(self, lookups):
features = {}
if "kern" in self.context.todo:
kern = ast.FeatureBlock("kern")
self._registerKernLookups(kern, lookups)
if kern.statements:
features["kern"] = kern
if "dist" in self.context.todo:
dist = ast.FeatureBlock("dist")
self._registerDistLookups(dist, lookups)
if dist.statements:
features["dist"] = dist
return features
def _makeMkmkFeature(self, include):
feature = ast.FeatureBlock("mkmk")
for anchorName, attachments in sorted(
self.context.markToMarkAttachments.items()
):
lkp = self._makeMarkToMarkLookup(anchorName, attachments, include)
if lkp is not None:
feature.statements.append(lkp)
return feature if feature.statements else None