toolsFL¶
T.O.O.L.S.: Things Other Objects Lack (Sometimes) -assorted raw tools.
This is an assorted colection of raw tools that do things inside of FontLab. Many of these functions form the bedrock of objectsFL. In short, use these tools only if you need the raw functions and they are not supported by the objects.
Object model: Most of these tools were written before objectsFL. Some of these tools are used by objectsFL. That means that if you want to use functions from robofab.tools you can always feed them FontLab objects (like Font, Glyps, etc.). If the functions also accept Robjects from robofab.objects it is usually mentioned in the doc string.
This is a simple way to convert a robofab Font object back to a FL Font object. Even if you don’t know which particular faith an object belongs to you can use this:
font = unwrapFont(font)
-
AppFolderRenamer
()¶ This function will rename the folder that contains the FontLab application to a more specific name that includes the version of the application Warning: it messes with the paths of your app, if you have items that hardwired to this path you’d be in trouble.
-
GetFont
(full_name)¶ Return fontobjects which match full_name. Note: result is a list. Returns: a list of FL Font objects
-
AllFonts
()¶ Collect a list of all open fonts. Returns: a list of FL Font objects.
-
FontIndex
(font)¶ return the index of a specified FL Font
-
unwrapFont
(font)¶ Unwrap the font if it happens to be a RoboFab Font
-
MakeTempFont
(font, dupemark=None, removeOverlap=True, decompose=True)¶ Save the current FL Font, - close the file, - duplicate the file in the finder (icon looks weird, but it works) - open the duplicate - decompose the glyphs - remove overlaps - return the fontobject
font is either a FL Font or RF RFont object.
Problems: doesn’t check if the filename is getting too long. Note: it will overwrite older files with the same name.
-
makePSFontName
(name)¶ Create a postscript filename out of a regular postscript fontname, using the old fashioned macintosh 5:3:3 convention.
-
NewGlyph
(font, glyphName, clear=False, updateFont=True)¶ Make a new glyph if it doesn’t already exist, return the glyph. font is either a FL Font or RF RFont object. If updateFont is True the (very slow) fl.UpdateFont function will be called.
-
AddToAlias
(additions, sep='+')¶ additions is a dict with glyphnames as keys and glyphConstruction as values. In order to make a bunch of additions in one go rather than open and close the file for each name. Add a glyph to the alias.dat file if it doesn’t already exist. additions = {‘Gcircumflex’: [‘G’,’circumflex’], } Returns a list of only the added glyphnames.
-
GlyphIndexTable
(font)¶ Make a glyph index table for font
-
MakeReverseCompoMapping
(font)¶ Return a dict that maps glyph names to lists containing tuples of the form:
(clientGlyphName, componentIndex)
-
textPrinter
(text, name=None, path=None)¶ Write a string to a text file. If no name is given it becomes Untitled_hour_minute_second.txt . If no path is given it goes into the FontLab/RoboFab Data directory.
-
makeDataFolder
()¶ Make the RoboFab data folder
-
Log
(text=None)¶ Make an entry in the default log file.