objectsFL

UFO implementation for the objects as used by FontLab 4.5 and higher

class robofab.objects.objectsFL.PostScriptFontHintValues(font=None, impliedMasterIndex=0)

Wrapper for font-level PostScript hinting information for FontLab. Blues values, stem values.

class robofab.objects.objectsFL.PostScriptGlyphHintValues(glyph=None)

Wrapper for glyph-level PostScript hinting information for FontLab. vStems, hStems.

vHints

postscript hints: vertical hint zones

hHints

postscript hints: horizontal hint zones

robofab.objects.objectsFL.CurrentFont()

Return a RoboFab font object for the currently selected font.

robofab.objects.objectsFL.CurrentGlyph()

Return a RoboFab glyph object for the currently selected glyph.

robofab.objects.objectsFL.OpenFont(path=None, note=None)

Open a font from a path.

robofab.objects.objectsFL.NewFont(familyName=None, styleName=None)

Make a new font

robofab.objects.objectsFL.AllFonts()

Return a list of all open fonts.

robofab.objects.objectsFL.getGlyphFromMask(g)

Get a Fab glyph object for the data in the mask layer.

robofab.objects.objectsFL.setMaskToGlyph(maskGlyph, targetGlyph, clear=True)

Set the maskGlyph as a mask layer in targetGlyph. maskGlyph is a FontLab or RoboFab RGlyph, orphaned or not. targetGlyph is a FontLab RGLyph. clear is a bool. False: keep the existing mask data, True: clear the existing mask data.

class robofab.objects.objectsFL.RFont(font=None)

RoboFab UFO wrapper for FL Font object

info

font info object

features

features object

kerning

a kerning object

groups

a group object

lib

font lib object

fontIndex

the fontindex for this font

path

path to the font

fileName

the font’s file name

selection

the glyph selection in the font window

glyphs

A list of all glyphs in the font, to allow iterations through Font.glyphs

update()

Don’t forget to update the font when you are done.

save(path=None)

Save the font, path is required.

close(save=False)

Close the font, saving is optional.

newGlyph(glyphName, clear=True)

Make a new glyph.

insertGlyph(glyph, name=None)

Returns a new glyph that has been inserted into the font. name = another glyphname if you want to insert as with that.

removeGlyph(glyphName)

remove a glyph from the font

getOTClasses()

Return all OpenType classes as a dict. Relies on properly formatted classes.

setOTClasses(dict)

Set all OpenType classes.

getOTClass(name)

Get a specific OpenType class.

setOTClass(name, list)

Set a specific OpenType class.

getOTFeatures()

Return all OpenType features as a dict keyed by name. The value is a string of the text of the feature.

setOTFeatures(dict)

Set all OpenType features in the font.

getOTFeature(name)

return a specific OpenType feature.

setOTFeature(name, text)

Set a specific OpenType feature.

getVGuides()

Return a list of wrapped vertical guides in this RFont

getHGuides()

Return a list of wrapped horizontal guides in this RFont

appendHGuide(position, angle=0)

Append a horizontal guide

appendVGuide(position, angle=0)

Append a horizontal guide

removeHGuide(guide)

Remove a horizontal guide.

removeVGuide(guide)

Remove a vertical guide.

clearHGuides()

Clear all horizontal guides.

clearVGuides()

Clear all vertical guides.

generate(outputType, path=None)

generate the font. outputType is the type of font to ouput. –Ouput Types: ‘pctype1’ : PC Type 1 font (binary/PFB) ‘pcmm’ : PC MultipleMaster font (PFB) ‘pctype1ascii’ : PC Type 1 font (ASCII/PFA) ‘pcmmascii’ : PC MultipleMaster font (ASCII/PFA) ‘unixascii’ : UNIX ASCII font (ASCII/PFA) ‘mactype1’ : Mac Type 1 font (generates suitcase and LWFN file) ‘otfcff’ : PS OpenType (CFF-based) font (OTF) ‘otfttf’ : PC TrueType/TT OpenType font (TTF) ‘macttf’ : Mac TrueType font (generates suitcase) ‘macttdfont’ : Mac TrueType font (generates suitcase with resources in data fork)

path can be a directory or a directory file name combo: path=”DirectoryA/DirectoryB” path=”DirectoryA/DirectoryB/MyFontName” if no path is given, the file will be output in the same directory as the vfb file. if no file name is given, the filename will be the vfb file name with the appropriate suffix.

readUFO(path, doProgress=False, doHints=False, doInfo=True, doKerning=True, doGroups=True, doLib=True, doFeatures=True, glyphs=None)

read a .ufo into the font

class robofab.objects.objectsFL.RGlyph(flGlyph)

RoboFab wrapper for FL Glyph object

lib

glyph lib object

index

return the index of the glyph in the font

name
psName

name

unicode
unicodes
width

the width

box

box of glyph as a tuple (xMin, yMin, xMax, yMax)

selected

Select or deselect the glyph in the font window

mark
note
psHints

postscript hint data

update()

Don’t forget to update the glyph when you are done.

GetBoundingRect(masterIndex)

FL compatibility

GetMetrics(masterIndex)

FL compatibility

SetMetrics(value, masterIndex)

FL compatibility

anchors

allow for iteration through glyph.anchors

components

allow for iteration through glyph.components

contours

allow for iteration through glyph.contours

getAnchors()

Return a list of wrapped anchors in this RGlyph.

getComponents()

Return a list of wrapped components in this RGlyph.

getVGuides()

Return a list of wrapped vertical guides in this RGlyph

getHGuides()

Return a list of wrapped horizontal guides in this RGlyph

appendComponent(baseGlyph, offset=(0, 0), scale=(1, 1))

Append a component to the glyph. x and y are optional offset values

appendAnchor(name, position)

Append an anchor to the glyph

appendHGuide(position, angle=0)

Append a horizontal guide

appendVGuide(position, angle=0)

Append a horizontal guide

clearComponents()

Clear all components.

clearAnchors()

Clear all anchors.

clearHGuides()

Clear all horizontal guides.

clearVGuides()

Clear all vertical guides.

removeComponent(component)

Remove a specific component from the glyph. This only works if the glyph does not have duplicate components in the same location.

removeContour(index)

remove a specific contour from the glyph

removeAnchor(anchor)

Remove a specific anchor from the glyph. This only works if the glyph does not have anchors with duplicate names in exactly the same location with the same mark.

removeHGuide(guide)

Remove a horizontal guide.

removeVGuide(guide)

Remove a vertical guide.

center(padding=None)

Equalise sidebearings, set to padding if wanted.

removeOverlap()

Remove overlap

decompose()

Decompose all components

autoHint()

Automatically generate type 1 hints.

move((x, y), contours=True, components=True, anchors=True)

Move a glyph’s items that are flagged as True

clear(contours=True, components=True, anchors=True, guides=True, hints=True)

Clear all items marked as true from the glyph

copy(aParent=None)

Make a copy of this glyph. Note: the copy is not a duplicate fontlab glyph, but a RF RGlyph with the same outlines. The new glyph is not part of the fontlab font in any way. Use font.appendGlyph(glyph) to get it in a FontLab glyph again.

class robofab.objects.objectsFL.RContour(index)

RoboFab wrapper for non FL contour object

index

the index of the contour

selected

selection of the contour: 1-selected or 0-unselected

insertSegment(index, segmentType, points, smooth=False)

insert a seggment into the contour

removeSegment(index)

remove a segment from the contour

reverseContour()

reverse contour direction

setStartSegment(segmentIndex)

set the first node on the contour

copy(aParent=None)

Copy this object – result is an ObjectsRF flavored object. There is no way to make this work using FontLab objects. Copy is mainly used for glyphmath.

class robofab.objects.objectsFL.RComponent(flComponent, index)

RoboFab wrapper for FL Component object

index

index of component

offset

the offset of the component

scale

the scale of the component

move((x, y))

Move the component

decompose()

Decompose the component

copy(aParent=None)

Copy this object – result is an ObjectsRF flavored object. There is no way to make this work using FontLab objects. Copy is mainly used for glyphmath.

class robofab.objects.objectsFL.RAnchor(flAnchor, index)

RoboFab wrapper for FL Anchor object

y
x
name
mark
index

index of the anchor

position

position of the anchor

class robofab.objects.objectsFL.RGuide(flGuide, index)

RoboFab wrapper for FL Guide object

position
angle
index

index of the guide

class robofab.objects.objectsFL.RGroups(aDict)

RoboFab wrapper for FL group data

class robofab.objects.objectsFL.RKerning(kerningDict=None)

RoboFab wrapper for FL Kerning data

update(kerningDict)

replace kerning data with the data in the given kerningDict

clear()

clear all kerning

class robofab.objects.objectsFL.RLib(aDict)

RoboFab wrapper for FL lib

class robofab.objects.objectsFL.RInfo(font)

RoboFab wrapper for FL Font Info