mojo.tools
registerFileExtension(fileExtension)
Register a file extension, and set RoboFont as the default application to open it.
IntersectGlyphWithLine(glyph, line, canHaveComponent=False, addSideBearings=False)
Intersect a glyph with a line. Returns a list of intersections.
IntersectGlyphWithLine(myGlyph, ((100, 50), (800, 50)), canHaveComponent=True, addSideBearings=True)
union(glyph, subjectContours, clipContours, roundCoordinates=None)
Draw the union between subjectContours
and clipContours
into the destination glyph
.
union(glyph, subjectContours, clipContours, roundCoordinates=None)
Both subjectContours
and clipContours
can be a list of contour objects or a glyph object.
If roundCoordinates
is None
, the default rounding value in the Preferences will be used.
difference(glyph, subjectContours, clipContours, roundCoordinates=None)
Draw the difference between subjectContours
and clipContours
into the destination glyph
.
difference(glyph, subjectContours, clipContours, roundCoordinates=None)
Both subjectContours
and clipContours
can be a list of contour objects or a glyph object.
If roundCoordinates
is None
, the default rounding value in the Preferences will be used.
intersection(glyph, subjectContours, clipContours, roundCoordinates=None)
Draw the intersection between subjectContours
and clipContours
into the destination glyph
.
intersection(glyph, subjectContours, clipContours, roundCoordinates=None)
Both subjectContours
and clipContours
can be a list of contour objects or a glyph object.
If roundCoordinates
is None
, the default rounding value in the Preferences will be used.
xor(glyph, subjectContours, clipContours, roundCoordinates=None)
Draw the exclusive or (XOR) between subjectContours
and clipContours
into the destination glyph
.
xor(glyph, subjectContours, clipContours, roundCoordinates=None)
Both subjectContours
and clipContours
can be a list of contour objects or a glyph object.
If roundCoordinates
is None
, the default rounding value in the Preferences will be used.
walkDirectoryForFile(dir, ext='.py')
Walk a given folder
recursively and collect the paths of all files with a given extension ext
.
roboFontUnitTest(classes=[], modules=[])
Perform a unit test inside RoboFont.
Optionally, provide a list of classes or a list of module paths to run the test on.
class BooleanGlyph()
A glyph-like object that can be used for handling boolean operations with glyph contours.
union
result = BooleanGlyph(glyph) + BooleanGlyph(glyph2)
# or
result = BooleanGlyph(glyph) | BooleanGlyph(glyph2)
difference
result = BooleanGlyph(glyph) - BooleanGlyph(glyph2)
intersection
result = BooleanGlyph(glyph) & BooleanGlyph(glyph2)
xor
result = BooleanGlyph(glyph) ^ BooleanGlyph(glyph2)