mtiLib: Read Monotype FontDame source files

FontTools provides support for reading the OpenType layout tables produced by Monotype’s FontDame and Font Chef font editors. These tables are written in a simple textual format. The mtiLib library parses these text files and creates table objects representing their contents.

Additionally, fonttools mtiLib will convert a text file to TTX XML.

class fontTools.mtiLib.DeferredMapping[source]

Bases: dict

clear() None.  Remove all items from D.
copy() a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values
exception fontTools.mtiLib.FeatureNotFoundError[source]

Bases: ReferenceNotFoundError

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception fontTools.mtiLib.LookupNotFoundError[source]

Bases: ReferenceNotFoundError

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception fontTools.mtiLib.MtiLibError[source]

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception fontTools.mtiLib.ReferenceNotFoundError[source]

Bases: MtiLibError

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

fontTools.mtiLib.build(f, font, tableTag=None)[source]

Convert a Monotype font layout file to an OpenType layout object

A font object must be passed, but this may be a “dummy” font; it is only used for sorting glyph sets when making coverage tables and to hold the OpenType layout table while it is being built.

Parameters:
  • f – A file object.

  • font (TTFont) – A font object.

  • tableTag (string) – If provided, asserts that the file contains data for the given OpenType table.

Returns:

An object representing the table. (e.g. table_G_S_U_B_)

fontTools.mtiLib.main(args=None, font=None)[source]

Convert a FontDame OTL file to TTX XML

Writes XML output to stdout.

Parameters:

args – Command line arguments (--font, --table, input files).