mojo.tools

GN2UV

UV2GN

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.

unicodeToChar(uni)

Convert unicode value to character. Supports big unicodes.

charToUnicode(char)

Convert character to unicode value. Supports big unicodes.

walkDirectoryForFile(dir, ext='.py')

Walk a given folder recursively and collect the paths of all files with a given extension ext.

imagePNGData(path)

Return png data from a path to an image file.

tiff2png(tiffdata)

Convert tiff data to png.

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.

timerDecorator(func)

Decorating a method with a timer.

timerFunction(func, repeat=1000, **kwargs)

Timer a function reapeatitly.

def myFunc(foo, bar):
    foo ** bar

timerFunction(myFunc, repeat=300, foo=10, bar=20)

profile(func, *args, **kwargs)

Print out a profile of a function.

def myFunc(foo, bar):
    for f in range(foo):
        for b in range(bar):
            f * b

profile(myFunc, foo=10, bar=20)

profileDecorator(func)

Decorating a method with a profiler.

ScriptRunner(text=None, path=None, stdout=None, stderr=None, namespace=None, checkSyntaxOnly=False, threaded=False)

Excecute a text or a python file path inside RoboFont. Optionally provide a stdout, stderr, namespace. Be carefull when setting threaded to True.

rgbaToString(rgba)

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)
Inherits from subclass: mojo.tools.BooleanGlyph

class RoboFontError()

Common base class for all non-exit exceptions.

class CallbackWrapper()

A wrapper for an NSCallback to a normal Python object.

action_()

doubleAction_()

Inherits from subclass: objc._PyObjCIntermediate_NSObject

class nsCallbackWrapper()

A wrapper for an NSObject callback.

action(sender)

class Timer()

A with statement timing everything inside and printing out the duration.

with Timer(name="dummy"):
    for i in range(10):
        j = i * i
Last edited on 08/12/2024