mtiLib: Read Monotype FontDame source files

Overview

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, running the fonttools mtiLib command will convert a text file to TTX XML.

Module members:

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).

exception fontTools.mtiLib.MtiLibError[source]

Bases: Exception

exception fontTools.mtiLib.ReferenceNotFoundError[source]

Bases: MtiLibError

exception fontTools.mtiLib.FeatureNotFoundError[source]

Bases: ReferenceNotFoundError

exception fontTools.mtiLib.LookupNotFoundError[source]

Bases: ReferenceNotFoundError

fontTools.mtiLib.makeGlyph(s)[source]
fontTools.mtiLib.makeGlyphs(l)[source]
fontTools.mtiLib.mapLookup(sym, mapping)[source]
fontTools.mtiLib.mapFeature(sym, mapping)[source]
fontTools.mtiLib.setReference(mapper, mapping, sym, setter, collection, key)[source]
class fontTools.mtiLib.DeferredMapping[source]

Bases: dict

addDeferredMapping(setter, sym, e)[source]
applyDeferredMappings()[source]
fontTools.mtiLib.parseScriptList(lines, featureMap=None)[source]
fontTools.mtiLib.parseFeatureList(lines, lookupMap=None, featureMap=None)[source]
fontTools.mtiLib.parseLookupFlags(lines)[source]
fontTools.mtiLib.parseSingleSubst(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseMultiple(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseAlternate(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseLigature(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseSinglePos(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parsePair(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseKernset(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.makeAnchor(data, klass=<class 'fontTools.ttLib.tables.otTables.Anchor'>)[source]
fontTools.mtiLib.parseCursive(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.makeMarkRecords(data, coverage, c)[source]
fontTools.mtiLib.makeBaseRecords(data, coverage, c, classCount)[source]
fontTools.mtiLib.makeLigatureRecords(data, coverage, c, classCount)[source]
fontTools.mtiLib.parseMarkToSomething(lines, font, c)[source]
class fontTools.mtiLib.MarkHelper[source]

Bases: object

class fontTools.mtiLib.MarkToBaseHelper[source]

Bases: MarkHelper

Mark = 'Mark'
Base = 'Base'
Type

alias of MarkBasePos

class fontTools.mtiLib.MarkToMarkHelper[source]

Bases: MarkHelper

Mark = 'Mark1'
Base = 'Mark2'
Type

alias of MarkMarkPos

class fontTools.mtiLib.MarkToLigatureHelper[source]

Bases: MarkHelper

Mark = 'Mark'
Base = 'Ligature'
Type

alias of MarkLigPos

fontTools.mtiLib.parseMarkToBase(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseMarkToMark(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseMarkToLigature(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.stripSplitComma(line)[source]
fontTools.mtiLib.intSplitComma(line)[source]
class fontTools.mtiLib.ContextHelper(klassName, Format)[source]

Bases: object

fontTools.mtiLib.parseLookupRecords(items, klassName, lookupMap=None)[source]
fontTools.mtiLib.makeClassDef(classDefs, font, klass=<class 'fontTools.ttLib.tables.otTables.Coverage'>)[source]
fontTools.mtiLib.parseClassDef(lines, font, klass=<class 'fontTools.ttLib.tables.otTables.ClassDef'>)[source]
fontTools.mtiLib.makeCoverage(glyphs, font, klass=<class 'fontTools.ttLib.tables.otTables.Coverage'>)[source]
fontTools.mtiLib.parseCoverage(lines, font, klass=<class 'fontTools.ttLib.tables.otTables.Coverage'>)[source]
fontTools.mtiLib.bucketizeRules(self, c, rules, bucketKeys)[source]
fontTools.mtiLib.parseContext(lines, font, Type, lookupMap=None)[source]
fontTools.mtiLib.parseContextSubst(lines, font, lookupMap=None)[source]
fontTools.mtiLib.parseContextPos(lines, font, lookupMap=None)[source]
fontTools.mtiLib.parseChainedSubst(lines, font, lookupMap=None)[source]
fontTools.mtiLib.parseChainedPos(lines, font, lookupMap=None)[source]
fontTools.mtiLib.parseReverseChainedSubst(lines, font, _lookupMap=None)[source]
fontTools.mtiLib.parseLookup(lines, tableTag, font, lookupMap=None)[source]
fontTools.mtiLib.parseGSUBGPOS(lines, font, tableTag)[source]
fontTools.mtiLib.parseGSUB(lines, font)[source]
fontTools.mtiLib.parseGPOS(lines, font)[source]
fontTools.mtiLib.parseAttachList(lines, font)[source]
fontTools.mtiLib.parseCaretList(lines, font)[source]
fontTools.mtiLib.makeMarkFilteringSets(sets, font)[source]
fontTools.mtiLib.parseMarkFilteringSets(lines, font)[source]
fontTools.mtiLib.parseGDEF(lines, font)[source]
fontTools.mtiLib.parseCmap(lines, font)[source]
fontTools.mtiLib.parseCmapId(lines, field)[source]
fontTools.mtiLib.parseTable(lines, font, tableTag=None)[source]
class fontTools.mtiLib.Tokenizer(f)[source]

Bases: object

next()[source]
peek()[source]
peeks()[source]
between(tag)[source]
until(tags)[source]
expect(s)[source]
expectendswith(s)[source]