User Guide
Macro Programming
703
There are several important methods:
Close(fontindex)
Closes the current or 'fontindex' font
Open(filename)
Open(filename, addtolist)
Opens the font from the file using the current
opening options. If 'addtolist' is True, the font is
added to FontLab's font list
Save(filename)
Save (fontindex, filename)
Saves the current or selected font using the
standard FontLab Save routine
Add(font) Adds 'font' to the list of open fonts and opens the
Font Window for it
UpdateFont()
UpdateFont(fontindex)
Updates the current font or 'fontindex' (slow
operation)
UpdateGlyph()
UpdateGlyph (glyphindex)
Updates the current or 'glyphindex' glyph of the
current font
EditGlyph()
EditGlyph (glyphindex)
Opens a Glyph window for the 'glyphindex' glyph in
the current font
Selected()
Selected(glyphindex)
Returns True if the current glyph or 'glyphindex'
glyph is selected (relatively slow operation)
Select(glyphid)
Select(glyphid, value)
Changes the glyph's selection state. 'glyphid' may be
string (glyph name), Uni (Unicode index) or integer
(glyph index)
Unselect() Deselects all glyphs in the current font (fast
operation)
Message(message, question,
OKstring, Cancelstring)
Shows the alert message dialog box, all the
parameters but the first can be omitted
BeginProgress(title, counts)
Opens the Progress dialog box with. 'counts' -
number of 'ticks'
EndProgress()
Closes the Progress dialog box
TickProgress(tick) Updates the Progress bar, returns False if Cancel
button was pressed. This is a relatively slow
operation
Random(hivalue)
Random(lovalue, hivalue)
Returns a random value (very fast operation)
ForSelected(function_name)
calls 'function_name' for each selected glyph in the
current font. Function has the following format:
function(Font font, Glyph glyph, glyphindex)
We will provide some examples using the functions described above when
we discuss Font and Glyph classes.