How to use the ufo2ft.featureWriters.ast.Anchor 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
def _defineMarkClass(self, glyphName, x, y, className, markClasses):
        anchor = ast.Anchor(x=otRound(x), y=otRound(y))
        markClass = markClasses.get(className)
        if markClass is None:
            markClass = ast.MarkClass(className)
            markClasses[className] = markClass
        else:
            if glyphName in markClass.glyphs:
                mcdef = markClass.glyphs[glyphName]
                if self._anchorsAreEqual(anchor, mcdef.anchor):
                    self.log.debug(
                        "Glyph %s already defined in markClass @%s",
                        glyphName,
                        className,
                    )
                    return None
                else:
                    # same mark glyph defined with different anchors for the
github alif-type / reem-kufi / tools / markFeatureWriter / __init__.py View on Github external
def _makeAnchorFormatA(x, y):
        return ast.Anchor(x=otRound(x), y=otRound(y))
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / markFeatureWriter.py View on Github external
def _marksAsAST(self):
        return [
            (ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)), anchor.markClass)
            for anchor in sorted(self.marks, key=lambda a: a.name)
        ]
github googlefonts / ufo2ft / Lib / ufo2ft / featureWriters / markFeatureWriter.py View on Github external
def _marksAsAST(self):
        return [
            [
                (ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)), anchor.markClass)
                for anchor in sorted(component, key=lambda a: a.name)
            ]
            for component in self.marks
        ]