(font)
Removes anchor classes (and associated lookups) that are used only
    internally for building composite glyph.
Removes anchor classes (and associated lookups) that are used only
    internally for building composite glyph.
Removes anchor classes ( and associated lookups ) that are used only internally for building composite glyph .
def cleanAnchors(font):
    """Removes anchor classes (and associated lookups) that are used only
    internally for building composite glyph."""

    lookups = (
            "markDash",
           #"markDigitAbove",
            "markDigitBelow",
            "markDotAbove",
            "markDotAlt",
            "markDotBelow",
            "markDotBelowAlt",
            "markDotHmaza",
            "markMarkDotAbove",
            "markMarkDotBelow",
            "markRingBelow",
            "markRingDash",
            "markStroke",
           #"markTaaAbove",
            "markTaaBelow",
            "markTail",
            "markTashkilAboveDot",
            "markTashkilBelowDot",
            "markTwoDotsAbove",
            "markTwoDotsBelow",
            "markTwoDotsBelowAlt",
            "markVAbove",
            )

    def keep(s):
        if isinstance(s, ast.LookupBlock) and s.name in lookups:
            return False
        if isinstance(s, ast.LookupReferenceStatement) and s.lookup.name in lookups:
            return False
        return True

    glyphnames = set(g.name for g in font)
    fea = font.features.text = parseFea(font.features.text, glyphnames)
    fea.statements = [s for s in fea.statements if  keep(s)]
    for block in fea.statements:
        if hasattr(block, "statements"):
            block.statements = [s for s in block.statements if keep(s)]
def cleanAnchors ( font ) : lookups = ( "markDash" , #"markDigitAbove", "markDigitBelow" , "markDotAbove" , "markDotAlt" , "markDotBelow" , "markDotBelowAlt" , "markDotHmaza" , "markMarkDotAbove" , "markMarkDotBelow" , "markRingBelow" , "markRingDash" , "markStroke" , #"markTaaAbove", "markTaaBelow" , "markTail" , "markTashkilAboveDot" , "markTashkilBelowDot" , "markTwoDotsAbove" , "markTwoDotsBelow" , "markTwoDotsBelowAlt" , "markVAbove" , ) def keep ( s ) : if isinstance ( s , ast . LookupBlock ) and s . name in lookups : return False if isinstance ( s , ast . LookupReferenceStatement ) and s . lookup . name in lookups : return False return True glyphnames = set ( g . name for g in font ) fea = font . features . text = parseFea ( font . features . text , glyphnames ) fea . statements = [ s for s in fea . statements if keep ( s ) ] for block in fea . statements : if hasattr ( block , "statements" ) : block . statements = [ s for s in block . statements if keep ( s ) ]