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