See the RoboFab site for an extended object descriptions. There are some additional RoboFont specific methods and attributes added to some objects.
Base Objects
Allmost every class used has some additional attributes.
Methods
- addObserver(observer, methodName, notification)
adds an observer to the object that notifies the methodName of the observer for a given notification - removeObserver(observer, notification)
removes the observer for a given notification
Font Object
Create a new font object:
- RFont(path=None, showUI=True)
ShowUI will toggle the creating of all interface objects around a font.
Methods
- document()
returns the related NSDocument - renameGlyph(oldName, newName, renameComponents=True, renameGroups=True, renameKerning=True)
Rename a glyph in the font.
Optionally the glyph can be renamed in all component references, groups and kerning. - generate(path, format, decompose=False, checkOutlines=False, autohint=False, releaseMode=False, glyphOrder=None, progressBar=None, useMacRoman=False)
Generate a font binary to the given path with the given format ("otf", "ttf", "pfa")
Adding a progressBar object will show you the progress during compiling the font. - removeOverlap()
removes all overlaps in every glyphs - extremePoints()
adds extremes points for every glyph - testInstall()
test instals the font, it returns the ID of the installed font on the os. - removeLayer(layerName)
removes a complete layer, to create a layer just ask any glyph.getLayer("myLayerName") - addGuide((x, y), angle, name="")
adds a guide at point x, y with angle and name
returning the created guide - removeGuide(guide)
gwill remove the guide from the font - update()
tell the UI that a font has changed directly - prepareUndo(undoTitle="")
This marks to glyph to be ready that a action begins and it should be recorded to create an undo item when its done - performUndo()
creates the undo item - setLayerDisplay(layerName, option, value)
set display options for layers option: Fill, Stroke, Points, Coordinates
Attributes
- glyphOrder
returns a list of glyph names in a specific order, it is possible to set the a list with a specific order in a font - layerOrder
returns a list of layernames - guides
a list of all the guides in the glyph - templateSelection
next to the font.selection, which only contains glyphs in the font there is also a selection of template glyphs
Glyph Object
Methods
- addGuide((x, y), angle, name="")
adds a guide at point x, y with angle and name
returning the created guide - removeGuide(guide)
will remove the guide from the glyph - addImage(path, offset=None)
adds an image from path with offset
returning the created guide - clearImage()
remove the image - removeOverlap()
removes all overlaps in every glyphs - extremePoints()
adds extremes points for every glyph - deselect()
deselect everything - getLayer(layerName, clear=True)
return the glyph for that layer, create a layer new layer if the layerName doesn't exists - copyToLayer(layerName, clear=True)
copy the current layer to the a layer with the layerName - swapToLayer(layerName)
swap current layer with the a layer with the layerName - flipLayers(layer1Name, layer2Name)
flip layers - update()
tell the UI that the glyph has changed directly
Attributes
- angledLeftMargin
returns the angled left margin based on the italic angle in the font.info - angledRightMargin
returns the angled right margin based on the italic angle in the font.info - mark
a tuple of 4 (r, g, b, a) - image
the image object, if no image is set it will be None - guides
a list of all the guides in the glyph - selection
a list of selected points - selected
returning True or False if yhe object is selected or not
Boolean Glyph
- glyph | otherGlyph
returns the union of the contours
- glyph % otherGlyph
returns the difference of the glyph contours - glyph & otherGlyph
returns the intersection of the glyph contours - glyph ^ otherGlyph
returns the xor of the glyph contours
Guide Object
Attributes
- x
The x of origin the guide. - y
The y of origin the guide. - angle
The angle of guide. - name
The name of the guide - isGlobal
returning if the guide is connected to a font object or glyph object
Image Object
Methods
- transform(tranformation)
Transform the image with a transform matrix (xy, yy, xx, yx, x, y) - move((x, y))
Move the image with a given x, y - translate((x, y))
Translate the image with a given x, y - skew(angle, offset=None)
Skew the image with a given angle, optionally with an offset (x, y) - rotate(angle, offset=None)
Rotate the image with a given angle, optionally with an offset (x, y) - scale((x, y), center=(0, 0))
Scale the image with a given x, y, optionally with a center coordinate
Attributes
- path
path to the image - bounds
image bounding box - brightness
set brightness of the image (float) - contrast
set contrast of the image (float) - saturation
set saturation of the image (float) - sharpness
set sharpness of the image (float) - blackAndWhite
convert image to black and white (bool) - selected
Contour Object
Methods
- join()
will close an open contour - extremePoints()
adds extremes points for every glyph