Example #1
0
 def setContext(self, font, feaFile, compiler=None):
     ctx = super(MarkFeatureWriter, self).setContext(font,
                                                     feaFile,
                                                     compiler=compiler)
     ctx.gdefClasses = ast.getGDEFGlyphClasses(feaFile)
     ctx.anchorLists = self._getAnchorLists()
     ctx.anchorPairs = self._getAnchorPairs()
Example #2
0
    def setContext(self, font, feaFile, compiler=None):
        ctx = super().setContext(font, feaFile, compiler=compiler)
        ctx.gdefClasses = ast.getGDEFGlyphClasses(feaFile)
        ctx.kerning = self.getKerningData(font, feaFile,
                                          self.getOrderedGlyphSet())

        feaScripts = ast.getScriptLanguageSystems(feaFile)
        ctx.scriptGroups = self._groupScriptsByTagAndDirection(feaScripts)

        return ctx
Example #3
0
    def getGDEFGlyphClasses(self):
        """Return a tuple of GDEF GlyphClassDef base, ligature, mark, component
        glyph names.
        Sets are `None` if no 'public.openTypeCategories' values are defined or
        if no GDEF table is defined in the feature file.
        """
        feaFile = self.context.feaFile

        if ast.findTable(feaFile, "GDEF") is not None:
            return ast.getGDEFGlyphClasses(feaFile)

        unassigned, bases, ligatures, marks, components = self.getOpenTypeCategories()

        if not any((unassigned, bases, ligatures, marks, components)):
            return ast._GDEFGlyphClasses(None, None, None, None)
        return ast._GDEFGlyphClasses(
            frozenset(bases),
            frozenset(ligatures),
            frozenset(marks),
            frozenset(components),
        )