mojo.tools

from mojo.tools import IntersectGlyphWithLine
  • IntersectGlyphWithLine(glyph, ((sx, sy), (ex, ey)), canHaveComponent=False, addSideBearings=False)
    Returns a list of intersections of a glyph with a given line. 
  • union(glyph, subjectContours, clipContours, roundCoordinates=None)
    perform a union with subject contours and clip contours
    glyph: destination glyph
    subjectContours, clipContours: for union its not really important so you can mix both
    roundCoordinates: optionally round the result
  • intersect(glyph, subjectContours, clipContours, roundCoordinates=None)
    perform a intersection with subject contours and clip contours
    glyph: destination glyph
    subjectContours: the subject contours
    clipContours
    : the clip contours that will intersect with the subject contours
    roundCoordinates: optionally round the result
  • difference(glyph, subjectContours, clipContours, roundCoordinates=None)
    perform a difference with subject contours and clip contours
    glyph: destination glyph
    subjectContours: the subject contours
    clipContours: the clip contours that will difference with the subject contours
    roundCoordinates: optionally round the result
  • intersection(glyph, subjectContours, clipContours, roundCoordinates=None)
    perform a intersection with subject contours and clip contours
    glyph: destination glyph
    subjectContours: the subject contours
    clipContours: the clip contours that will intersection with the subject contours
    roundCoordinates: optionally round the result
  • xor(glyph, subjectContours, clipContours, roundCoordinates=None)
    perform a xor with subject contours and clip contours
    glyph: destination glyph
    subjectContours: the subject contours
    clipContours: the clip contours that will xor with the subject contours
    roundCoordinates: optionally round the result

Classes

  • BooleanGlyph(glyph, roundCoordinates=None)
    A object that can be used to perform simple math operations and acts like a glyph object. 
    union ⇢ BooleanGlyph(glyph) | BooleanGlyph(glyph2)
    difference ⇢ BooleanGlyph(glyph) - BooleanGlyph(glyph2)
    intersection ⇢ BooleanGlyph(glyph) & BooleanGlyph(glyph2)
    xor ⇢ BooleanGlyph(glyph) ^ BooleanGlyph(glyph2)
     
    Initiate a BooleanGlyph object
    glyph: the source glyph
    roundCoordinates: optionally round the result
     
    draw(pen)
    draws the booleanGlyph in a pen
    drawPoints(pointPen)
    draws the booleanGlyph in a pointPen
    union(other)
    performs an union operation
    difference(other)
    performs a difference operation
    intersection(other)
    performs a intersection operation
    xor(other)
    performs a xor operation
     
    width
    returns the width of the booleanGlyph