Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __str__(self):
return self.asAST().asFea() # pragma: no cover
def filter(self, include):
marks = self._filterMarks(include)
return self.__class__(self.name, marks) if any(marks) else None
class MarkToBasePos(AbstractMarkPos):
Statement = ast.MarkBasePosStatement
class MarkToMarkPos(AbstractMarkPos):
Statement = ast.MarkMarkPosStatement
class MarkToLigaPos(AbstractMarkPos):
Statement = ast.MarkLigPosStatement
def _filterMarks(self, include):
return [
[anchor for anchor in component if include(anchor)]
for component in self.marks
]
def _marksAsAST(self):
return [
[
(ast.Anchor(x=otRound(anchor.x), y=otRound(anchor.y)), anchor.markClass)
def _makeMarkPosRule(cls, ruleType, baseName, x, y, markClass):
""" Return a MarkBasePosStatement for given rule type (either "base" or
"mark"), glyph name, anchor and markClass name.
"""
base = ast.GlyphName(baseName)
anchor = cls._makeAnchorFormatA(x, y)
marks = [(anchor, markClass)]
if ruleType == "base":
return ast.MarkBasePosStatement(base, marks)
elif ruleType == "mark":
return ast.MarkMarkPosStatement(base, marks)
else:
raise AssertionError(ruleType)
def __init__(self, side1, side2, value, directions=None, bidiTypes=None):
if isinstance(side1, basestring):
self.side1 = ast.GlyphName(side1)
elif isinstance(side1, ast.GlyphClassDefinition):
self.side1 = ast.GlyphClassName(side1)
else:
raise AssertionError(side1)
if isinstance(side2, basestring):
self.side2 = ast.GlyphName(side2)
elif isinstance(side2, ast.GlyphClassDefinition):
self.side2 = ast.GlyphClassName(side2)
else:
raise AssertionError(side2)
self.value = value
self.directions = directions or set()
self.bidiTypes = bidiTypes or set()