How to use the ufo2ft.featureWriters.ast.FeatureBlock function in ufo2ft

To help you get started, we’ve selected a few ufo2ft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alif-type / reem-kufi / tools / markFeatureWriter / __init__.py View on Github external
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
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / markFeatureWriter.py View on Github external
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
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / markFeatureWriter.py View on Github external
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
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / kernFeatureWriter.py View on Github external
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
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / markFeatureWriter.py View on Github external
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