cffLib: Read and write Adobe CFF fonts

Overview:

cffLib: read/write Adobe CFF fonts

OpenType fonts with PostScript outlines embed a completely independent font file in Adobe’s Compact Font Format. So dealing with OpenType fonts requires also dealing with CFF. This module allows you to read and write fonts written in the CFF format.

In 2016, OpenType 1.8 introduced the CFF2 format which, along with other changes, extended the CFF format to deal with the demands of variable fonts. This module parses both original CFF and CFF2.

Submodules:

cffLib contains submodules for converting between CCF and CFF2. Each can be used within other Python scripts or run as a subcommand of the fonttools command-line tool:

It also contains submodules for manipulating CFF-formatted glyphs:

Module members:

class fontTools.cffLib.CFFFontSet[source]

Bases: object

A CFF font “file” can contain more than one font, although this is extremely rare (and not allowed within OpenType fonts).

This class is the entry point for parsing a CFF table. To actually manipulate the data inside the CFF font, you will want to access the CFFFontSet’s TopDict object. To do this, a CFFFontSet object can either be treated as a dictionary (with appropriate keys() and values() methods) mapping font names to TopDict objects, or as a list.

from fontTools import ttLib
tt = ttLib.TTFont("Tests/cffLib/data/LinLibertine_RBI.otf")
tt["CFF "].cff
# <fontTools.cffLib.CFFFontSet object at 0x101e24c90>
tt["CFF "].cff[0] # Here's your actual font data
# <fontTools.cffLib.TopDict object at 0x1020f1fd0>
decompile(file, otFont, isCFF2=None)[source]

Parse a binary CFF file into an internal representation. file should be a file handle object. otFont is the top-level fontTools.ttLib.ttFont.TTFont object containing this CFF file.

If isCFF2 is passed and set to True or False, then the library makes an assertion that the CFF header is of the appropriate version.

keys()[source]
values()[source]
compile(file, otFont, isCFF2=None)[source]

Write the object back into binary representation onto the given file. file should be a file handle object. otFont is the top-level fontTools.ttLib.ttFont.TTFont object containing this CFF file.

If isCFF2 is passed and set to True or False, then the library makes an assertion that the CFF header is of the appropriate version.

toXML(xmlWriter)[source]

Write the object into XML representation onto the given fontTools.misc.xmlWriter.XMLWriter.

writer = xmlWriter.XMLWriter(sys.stdout)
tt["CFF "].cff.toXML(writer)
fromXML(name, attrs, content, otFont=None)[source]

Reads data from the XML element into the CFFFontSet object.

convertCFFToCFF2(otFont)[source]
convertCFF2ToCFF(otFont)[source]
desubroutinize()[source]
remove_hints()[source]
remove_unused_subroutines()[source]
class fontTools.cffLib.CFFWriter(isCFF2)[source]

Bases: object

Helper class for serializing CFF data to binary. Used by CFFFontSet.compile().

add(table)[source]
toFile(file)[source]
fontTools.cffLib.calcOffSize(largestOffset)[source]
class fontTools.cffLib.IndexCompiler(items, strings, parent, isCFF2=None)[source]

Bases: object

Base class for writing CFF INDEX data to binary.

getItems(items, strings)[source]
getOffsets()[source]
getDataLength()[source]
toFile(file)[source]
class fontTools.cffLib.IndexedStringsCompiler(items, strings, parent, isCFF2=None)[source]

Bases: IndexCompiler

getItems(items, strings)[source]
getDataLength()
getOffsets()
toFile(file)
class fontTools.cffLib.TopDictIndexCompiler(items, strings, parent, isCFF2=None)[source]

Bases: IndexCompiler

Helper class for writing the TopDict to binary.

getItems(items, strings)[source]
getChildren(strings)[source]
getOffsets()[source]
getDataLength()[source]
toFile(file)[source]
class fontTools.cffLib.FDArrayIndexCompiler(items, strings, parent, isCFF2=None)[source]

Bases: IndexCompiler

Helper class for writing the Font DICT INDEX to binary.

getItems(items, strings)[source]
getChildren(strings)[source]
toFile(file)[source]
setPos(pos, endPos)[source]
getDataLength()
getOffsets()
class fontTools.cffLib.GlobalSubrsCompiler(items, strings, parent, isCFF2=None)[source]

Bases: IndexCompiler

Helper class for writing the global subroutine INDEX to binary.

getItems(items, strings)[source]
getDataLength()
getOffsets()
toFile(file)
class fontTools.cffLib.SubrsCompiler(items, strings, parent, isCFF2=None)[source]

Bases: GlobalSubrsCompiler

Helper class for writing the local subroutine INDEX to binary.

setPos(pos, endPos)[source]
getDataLength()
getItems(items, strings)
getOffsets()
toFile(file)
class fontTools.cffLib.CharStringsCompiler(items, strings, parent, isCFF2=None)[source]

Bases: GlobalSubrsCompiler

Helper class for writing the CharStrings INDEX to binary.

getItems(items, strings)[source]
setPos(pos, endPos)[source]
getDataLength()
getOffsets()
toFile(file)
class fontTools.cffLib.Index(file=None, isCFF2=None)[source]

Bases: object

This class represents what the CFF spec calls an INDEX (an array of variable-sized objects). Index items can be addressed and set using Python list indexing.

compilerClass

alias of IndexCompiler

produceItem(index, data, file, offset)[source]
append(item)[source]

Add an item to an INDEX.

getCompiler(strings, parent, isCFF2=None)[source]
clear()[source]

Empty the INDEX.

class fontTools.cffLib.GlobalSubrsIndex(file=None, globalSubrs=None, private=None, fdSelect=None, fdArray=None, isCFF2=None)[source]

Bases: Index

This index contains all the global subroutines in the font. A global subroutine is a set of CharString data which is accessible to any glyph in the font, and are used to store repeated instructions - for example, components may be encoded as global subroutines, but so could hinting instructions.

Remember that when interpreting a callgsubr instruction (or indeed a callsubr instruction) that you will need to add the “subroutine number bias” to number given:

tt = ttLib.TTFont("Almendra-Bold.otf")
u = tt["CFF "].cff[0].CharStrings["udieresis"]
u.decompile()

u.toXML(XMLWriter(sys.stdout))
# <some stuff>
# -64 callgsubr <-- Subroutine which implements the dieresis mark
# <other stuff>

tt["CFF "].cff[0].GlobalSubrs[-64] # <-- WRONG
# <T2CharString (bytecode) at 103451d10>

tt["CFF "].cff[0].GlobalSubrs[-64 + 107] # <-- RIGHT
# <T2CharString (source) at 103451390>

(“The bias applied depends on the number of subrs (gsubrs). If the number of subrs (gsubrs) is less than 1240, the bias is 107. Otherwise if it is less than 33900, it is 1131; otherwise it is 32768.”, Subroutine Operators <https://docs.microsoft.com/en-us/typography/opentype/otspec180/cff2charstr#section4.4>)

compilerClass

alias of GlobalSubrsCompiler

subrClass

alias of T2CharString

charStringClass

alias of T2CharString

produceItem(index, data, file, offset)[source]
toXML(xmlWriter)[source]

Write the subroutines index into XML representation onto the given fontTools.misc.xmlWriter.XMLWriter.

writer = xmlWriter.XMLWriter(sys.stdout)
tt["CFF "].cff[0].GlobalSubrs.toXML(writer)
fromXML(name, attrs, content)[source]
getItemAndSelector(index)[source]
append(item)

Add an item to an INDEX.

clear()

Empty the INDEX.

getCompiler(strings, parent, isCFF2=None)
class fontTools.cffLib.SubrsIndex(file=None, globalSubrs=None, private=None, fdSelect=None, fdArray=None, isCFF2=None)[source]

Bases: GlobalSubrsIndex

This index contains a glyph’s local subroutines. A local subroutine is a private set of CharString data which is accessible only to the glyph to which the index is attached.

compilerClass

alias of SubrsCompiler

append(item)

Add an item to an INDEX.

charStringClass

alias of T2CharString

clear()

Empty the INDEX.

fromXML(name, attrs, content)
getCompiler(strings, parent, isCFF2=None)
getItemAndSelector(index)
produceItem(index, data, file, offset)
subrClass

alias of T2CharString

toXML(xmlWriter)

Write the subroutines index into XML representation onto the given fontTools.misc.xmlWriter.XMLWriter.

writer = xmlWriter.XMLWriter(sys.stdout)
tt["CFF "].cff[0].GlobalSubrs.toXML(writer)
class fontTools.cffLib.TopDictIndex(file=None, cff2GetGlyphOrder=None, topSize=0, isCFF2=None)[source]

Bases: Index

This index represents the array of TopDict structures in the font (again, usually only one entry is present). Hence the following calls are equivalent:

tt["CFF "].cff[0]
# <fontTools.cffLib.TopDict object at 0x102ed6e50>
tt["CFF "].cff.topDictIndex[0]
# <fontTools.cffLib.TopDict object at 0x102ed6e50>
compilerClass

alias of TopDictIndexCompiler

produceItem(index, data, file, offset)[source]
toXML(xmlWriter)[source]
append(item)

Add an item to an INDEX.

clear()

Empty the INDEX.

getCompiler(strings, parent, isCFF2=None)
class fontTools.cffLib.FDArrayIndex(file=None, isCFF2=None)[source]

Bases: Index

compilerClass

alias of FDArrayIndexCompiler

toXML(xmlWriter)[source]
produceItem(index, data, file, offset)[source]
fromXML(name, attrs, content)[source]
append(item)

Add an item to an INDEX.

clear()

Empty the INDEX.

getCompiler(strings, parent, isCFF2=None)
class fontTools.cffLib.VarStoreData(file=None, otVarStore=None)[source]

Bases: object

decompile()[source]
compile()[source]
writeXML(xmlWriter, name)[source]
xmlRead(name, attrs, content, parent)[source]
getNumRegions(vsIndex)[source]
class fontTools.cffLib.FDSelect(file=None, numGlyphs=None, format=None)[source]

Bases: object

append(fdSelectValue)[source]
class fontTools.cffLib.CharStrings(file, charset, globalSubrs, private, fdSelect, fdArray, isCFF2=None, varStore=None)[source]

Bases: object

The CharStrings in the font represent the instructions for drawing each glyph. This object presents a dictionary interface to the font’s CharStrings, indexed by glyph name:

tt["CFF "].cff[0].CharStrings["a"]
# <T2CharString (bytecode) at 103451e90>

See fontTools.misc.psCharStrings.T1CharString and fontTools.misc.psCharStrings.T2CharString for how to decompile, compile and interpret the glyph drawing instructions in the returned objects.

keys()[source]
values()[source]
has_key(name)[source]
getItemAndSelector(name)[source]
toXML(xmlWriter)[source]
fromXML(name, attrs, content)[source]
fontTools.cffLib.readCard8(file)[source]
fontTools.cffLib.readCard16(file)[source]
fontTools.cffLib.readCard32(file)[source]
fontTools.cffLib.writeCard8(file, value)[source]
fontTools.cffLib.writeCard16(file, value)[source]
fontTools.cffLib.writeCard32(file, value)[source]
fontTools.cffLib.packCard8(value)[source]
fontTools.cffLib.packCard16(value)[source]
fontTools.cffLib.packCard32(value)[source]
fontTools.cffLib.buildOperatorDict(table)[source]
fontTools.cffLib.buildOpcodeDict(table)[source]
fontTools.cffLib.buildOrder(table)[source]
fontTools.cffLib.buildDefaults(table)[source]
fontTools.cffLib.buildConverters(table)[source]
class fontTools.cffLib.SimpleConverter[source]

Bases: object

read(parent, value)[source]
write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
class fontTools.cffLib.ASCIIConverter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
class fontTools.cffLib.Latin1Converter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
fontTools.cffLib.parseNum(s)[source]
fontTools.cffLib.parseBlendList(s)[source]
class fontTools.cffLib.NumberConverter[source]

Bases: SimpleConverter

xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
write(parent, value)
class fontTools.cffLib.ArrayConverter[source]

Bases: SimpleConverter

xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
write(parent, value)
class fontTools.cffLib.TableConverter[source]

Bases: SimpleConverter

xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
write(parent, value)
class fontTools.cffLib.PrivateDictConverter[source]

Bases: TableConverter

getClass()[source]
write(parent, value)[source]
read(parent, value)
xmlRead(name, attrs, content, parent)
xmlWrite(xmlWriter, name, value)
class fontTools.cffLib.SubrsConverter[source]

Bases: TableConverter

getClass()[source]
write(parent, value)[source]
read(parent, value)
xmlRead(name, attrs, content, parent)
xmlWrite(xmlWriter, name, value)
class fontTools.cffLib.CharStringsConverter[source]

Bases: TableConverter

write(parent, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
xmlWrite(xmlWriter, name, value)
class fontTools.cffLib.CharsetConverter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
class fontTools.cffLib.CharsetCompiler(strings, charset, parent)[source]

Bases: object

setPos(pos, endPos)[source]
getDataLength()[source]
toFile(file)[source]
fontTools.cffLib.getStdCharSet(charset)[source]
fontTools.cffLib.getCIDfromName(name, strings)[source]
fontTools.cffLib.getSIDfromName(name, strings)[source]
fontTools.cffLib.packCharset0(charset, isCID, strings)[source]
fontTools.cffLib.packCharset(charset, isCID, strings)[source]
fontTools.cffLib.parseCharset0(numGlyphs, file, strings, isCID)[source]
fontTools.cffLib.parseCharset(numGlyphs, file, strings, isCID, fmt)[source]
class fontTools.cffLib.EncodingCompiler(strings, encoding, parent)[source]

Bases: object

setPos(pos, endPos)[source]
getDataLength()[source]
toFile(file)[source]
class fontTools.cffLib.EncodingConverter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
fontTools.cffLib.parseEncoding0(charset, file, haveSupplement, strings)[source]
fontTools.cffLib.parseEncoding1(charset, file, haveSupplement, strings)[source]
fontTools.cffLib.packEncoding0(charset, encoding, strings)[source]
fontTools.cffLib.packEncoding1(charset, encoding, strings)[source]
class fontTools.cffLib.FDArrayConverter[source]

Bases: TableConverter

write(parent, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
xmlWrite(xmlWriter, name, value)
class fontTools.cffLib.FDSelectConverter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
class fontTools.cffLib.VarStoreConverter[source]

Bases: SimpleConverter

write(parent, value)[source]
xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
fontTools.cffLib.packFDSelect0(fdSelectArray)[source]
fontTools.cffLib.packFDSelect3(fdSelectArray)[source]
fontTools.cffLib.packFDSelect4(fdSelectArray)[source]
class fontTools.cffLib.FDSelectCompiler(fdSelect, parent)[source]

Bases: object

setPos(pos, endPos)[source]
getDataLength()[source]
toFile(file)[source]
class fontTools.cffLib.VarStoreCompiler(varStoreData, parent)[source]

Bases: object

setPos(pos, endPos)[source]
getDataLength()[source]
toFile(file)[source]
class fontTools.cffLib.ROSConverter[source]

Bases: SimpleConverter

xmlWrite(xmlWriter, name, value)[source]
xmlRead(name, attrs, content, parent)[source]
read(parent, value)
write(parent, value)
fontTools.cffLib.addConverters(table)[source]
class fontTools.cffLib.TopDictDecompiler(strings, parent=None)[source]

Bases: DictDecompiler

operators = {(12, 0): ('Copyright', 'SID'), (12, 1): ('isFixedPitch', 'number'), (12, 2): ('ItalicAngle', 'number'), (12, 20): ('SyntheticBase', 'number'), (12, 21): ('PostScript', 'SID'), (12, 22): ('BaseFontName', 'SID'), (12, 23): ('BaseFontBlend', 'delta'), (12, 3): ('UnderlinePosition', 'number'), (12, 30): ('ROS', ('SID', 'SID', 'number')), (12, 31): ('CIDFontVersion', 'number'), (12, 32): ('CIDFontRevision', 'number'), (12, 33): ('CIDFontType', 'number'), (12, 34): ('CIDCount', 'number'), (12, 35): ('UIDBase', 'number'), (12, 36): ('FDArray', 'number'), (12, 37): ('FDSelect', 'number'), (12, 38): ('FontName', 'SID'), (12, 4): ('UnderlineThickness', 'number'), (12, 5): ('PaintType', 'number'), (12, 6): ('CharstringType', 'number'), (12, 7): ('FontMatrix', 'array'), (12, 8): ('StrokeWidth', 'number'), 0: ('version', 'SID'), 1: ('Notice', 'SID'), 13: ('UniqueID', 'number'), 14: ('XUID', 'array'), 15: ('charset', 'number'), 16: ('Encoding', 'number'), 17: ('CharStrings', 'number'), 18: ('Private', ('number', 'number')), 2: ('FullName', 'SID'), 24: ('VarStore', 'number'), 25: ('maxstack', 'number'), 3: ('FamilyName', 'SID'), 4: ('Weight', 'SID'), 5: ('FontBBox', 'array')}
arg_SID(name)
arg_array(name)
arg_blendList(name)

There may be non-blend args at the top of the stack. We first calculate where the blend args start in the stack. These are the last numMasters*numBlends) +1 args. The blend args starts with numMasters relative coordinate values, the BlueValues in the list from the default master font. This is followed by numBlends list of values. Each of value in one of these lists is the Variable Font delta for the matching region.

We re-arrange this to be a list of numMaster entries. Each entry starts with the corresponding default font relative value, and is followed by the delta values. We then convert the default values, the first item in each entry, to an absolute value.

arg_blend_number(name)
arg_delta(name)
arg_number(name)
decompile(data)
getDict()
handle_operator(operator)
operandEncoding = [<function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_shortInt>, <function read_longInt>, <function read_realNumber>, <function read_operator>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt2>, <function read_smallInt2>, <function read_smallInt2>, <function read_smallInt2>, <function read_reserved>]
pop()
popall()
class fontTools.cffLib.PrivateDictDecompiler(strings, parent=None)[source]

Bases: DictDecompiler

operators = {(12, 10): ('BlueShift', 'number'), (12, 11): ('BlueFuzz', 'number'), (12, 12): ('StemSnapH', 'delta'), (12, 13): ('StemSnapV', 'delta'), (12, 14): ('ForceBold', 'number'), (12, 15): ('ForceBoldThreshold', 'number'), (12, 16): ('lenIV', 'number'), (12, 17): ('LanguageGroup', 'number'), (12, 18): ('ExpansionFactor', 'number'), (12, 19): ('initialRandomSeed', 'number'), (12, 9): ('BlueScale', 'number'), 10: ('StdHW', 'number'), 11: ('StdVW', 'number'), 19: ('Subrs', 'number'), 20: ('defaultWidthX', 'number'), 21: ('nominalWidthX', 'number'), 22: ('vsindex', 'number'), 23: ('blend', 'blendList'), 6: ('BlueValues', 'delta'), 7: ('OtherBlues', 'delta'), 8: ('FamilyBlues', 'delta'), 9: ('FamilyOtherBlues', 'delta')}
arg_SID(name)
arg_array(name)
arg_blendList(name)

There may be non-blend args at the top of the stack. We first calculate where the blend args start in the stack. These are the last numMasters*numBlends) +1 args. The blend args starts with numMasters relative coordinate values, the BlueValues in the list from the default master font. This is followed by numBlends list of values. Each of value in one of these lists is the Variable Font delta for the matching region.

We re-arrange this to be a list of numMaster entries. Each entry starts with the corresponding default font relative value, and is followed by the delta values. We then convert the default values, the first item in each entry, to an absolute value.

arg_blend_number(name)
arg_delta(name)
arg_number(name)
decompile(data)
getDict()
handle_operator(operator)
operandEncoding = [<function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_operator>, <function read_shortInt>, <function read_longInt>, <function read_realNumber>, <function read_operator>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_byte>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt1>, <function read_smallInt2>, <function read_smallInt2>, <function read_smallInt2>, <function read_smallInt2>, <function read_reserved>]
pop()
popall()
class fontTools.cffLib.DictCompiler(dictObj, strings, parent, isCFF2=None)[source]

Bases: object

maxBlendStack = 0
setPos(pos, endPos)[source]
getDataLength()[source]
compile(reason)[source]
toFile(file)[source]
arg_number(num)[source]
arg_SID(s)[source]
arg_array(value)[source]
arg_delta(value)[source]
arg_delta_blend(value)[source]

A delta list with blend lists has to be all blend lists.

The value is a list is arranged as follows:

[
        [V0, d0..dn]
        [V1, d0..dn]
        ...
        [Vm, d0..dn]
]

V is the absolute coordinate value from the default font, and d0-dn are the delta values from the n regions. Each V is an absolute coordinate from the default font.

We want to return a list:

[
        [v0, v1..vm]
        [d0..dn]
        ...
        [d0..dn]
        numBlends
        blendOp
]

where each v is relative to the previous default font value.

fontTools.cffLib.encodeNumber(num)[source]
class fontTools.cffLib.TopDictCompiler(dictObj, strings, parent, isCFF2=None)[source]

Bases: DictCompiler

opcodes = {'BaseFontBlend': (b'\x0c\x17', 'delta'), 'BaseFontName': (b'\x0c\x16', 'SID'), 'CIDCount': (b'\x0c"', 'number'), 'CIDFontRevision': (b'\x0c ', 'number'), 'CIDFontType': (b'\x0c!', 'number'), 'CIDFontVersion': (b'\x0c\x1f', 'number'), 'CharStrings': (b'\x11', 'number'), 'CharstringType': (b'\x0c\x06', 'number'), 'Copyright': (b'\x0c\x00', 'SID'), 'Encoding': (b'\x10', 'number'), 'FDArray': (b'\x0c$', 'number'), 'FDSelect': (b'\x0c%', 'number'), 'FamilyName': (b'\x03', 'SID'), 'FontBBox': (b'\x05', 'array'), 'FontMatrix': (b'\x0c\x07', 'array'), 'FontName': (b'\x0c&', 'SID'), 'FullName': (b'\x02', 'SID'), 'ItalicAngle': (b'\x0c\x02', 'number'), 'Notice': (b'\x01', 'SID'), 'PaintType': (b'\x0c\x05', 'number'), 'PostScript': (b'\x0c\x15', 'SID'), 'Private': (b'\x12', ('number', 'number')), 'ROS': (b'\x0c\x1e', ('SID', 'SID', 'number')), 'StrokeWidth': (b'\x0c\x08', 'number'), 'SyntheticBase': (b'\x0c\x14', 'number'), 'UIDBase': (b'\x0c#', 'number'), 'UnderlinePosition': (b'\x0c\x03', 'number'), 'UnderlineThickness': (b'\x0c\x04', 'number'), 'UniqueID': (b'\r', 'number'), 'VarStore': (b'\x18', 'number'), 'Weight': (b'\x04', 'SID'), 'XUID': (b'\x0e', 'array'), 'charset': (b'\x0f', 'number'), 'isFixedPitch': (b'\x0c\x01', 'number'), 'maxstack': (b'\x19', 'number'), 'version': (b'\x00', 'SID')}
getChildren(strings)[source]
arg_SID(s)
arg_array(value)
arg_delta(value)
arg_delta_blend(value)

A delta list with blend lists has to be all blend lists.

The value is a list is arranged as follows:

[
        [V0, d0..dn]
        [V1, d0..dn]
        ...
        [Vm, d0..dn]
]

V is the absolute coordinate value from the default font, and d0-dn are the delta values from the n regions. Each V is an absolute coordinate from the default font.

We want to return a list:

[
        [v0, v1..vm]
        [d0..dn]
        ...
        [d0..dn]
        numBlends
        blendOp
]

where each v is relative to the previous default font value.

arg_number(num)
compile(reason)
getDataLength()
maxBlendStack = 0
setPos(pos, endPos)
toFile(file)
class fontTools.cffLib.FontDictCompiler(dictObj, strings, parent, isCFF2=None)[source]

Bases: DictCompiler

opcodes = {'BaseFontBlend': (b'\x0c\x17', 'delta'), 'BaseFontName': (b'\x0c\x16', 'SID'), 'CIDCount': (b'\x0c"', 'number'), 'CIDFontRevision': (b'\x0c ', 'number'), 'CIDFontType': (b'\x0c!', 'number'), 'CIDFontVersion': (b'\x0c\x1f', 'number'), 'CharStrings': (b'\x11', 'number'), 'CharstringType': (b'\x0c\x06', 'number'), 'Copyright': (b'\x0c\x00', 'SID'), 'Encoding': (b'\x10', 'number'), 'FDArray': (b'\x0c$', 'number'), 'FDSelect': (b'\x0c%', 'number'), 'FamilyName': (b'\x03', 'SID'), 'FontBBox': (b'\x05', 'array'), 'FontMatrix': (b'\x0c\x07', 'array'), 'FontName': (b'\x0c&', 'SID'), 'FullName': (b'\x02', 'SID'), 'ItalicAngle': (b'\x0c\x02', 'number'), 'Notice': (b'\x01', 'SID'), 'PaintType': (b'\x0c\x05', 'number'), 'PostScript': (b'\x0c\x15', 'SID'), 'Private': (b'\x12', ('number', 'number')), 'ROS': (b'\x0c\x1e', ('SID', 'SID', 'number')), 'StrokeWidth': (b'\x0c\x08', 'number'), 'SyntheticBase': (b'\x0c\x14', 'number'), 'UIDBase': (b'\x0c#', 'number'), 'UnderlinePosition': (b'\x0c\x03', 'number'), 'UnderlineThickness': (b'\x0c\x04', 'number'), 'UniqueID': (b'\r', 'number'), 'VarStore': (b'\x18', 'number'), 'Weight': (b'\x04', 'SID'), 'XUID': (b'\x0e', 'array'), 'charset': (b'\x0f', 'number'), 'isFixedPitch': (b'\x0c\x01', 'number'), 'maxstack': (b'\x19', 'number'), 'version': (b'\x00', 'SID')}
getChildren(strings)[source]
arg_SID(s)
arg_array(value)
arg_delta(value)
arg_delta_blend(value)

A delta list with blend lists has to be all blend lists.

The value is a list is arranged as follows:

[
        [V0, d0..dn]
        [V1, d0..dn]
        ...
        [Vm, d0..dn]
]

V is the absolute coordinate value from the default font, and d0-dn are the delta values from the n regions. Each V is an absolute coordinate from the default font.

We want to return a list:

[
        [v0, v1..vm]
        [d0..dn]
        ...
        [d0..dn]
        numBlends
        blendOp
]

where each v is relative to the previous default font value.

arg_number(num)
compile(reason)
getDataLength()
maxBlendStack = 0
setPos(pos, endPos)
toFile(file)
class fontTools.cffLib.PrivateDictCompiler(dictObj, strings, parent, isCFF2=None)[source]

Bases: DictCompiler

maxBlendStack = 513
opcodes = {'BlueFuzz': (b'\x0c\x0b', 'number'), 'BlueScale': (b'\x0c\t', 'number'), 'BlueShift': (b'\x0c\n', 'number'), 'BlueValues': (b'\x06', 'delta'), 'ExpansionFactor': (b'\x0c\x12', 'number'), 'FamilyBlues': (b'\x08', 'delta'), 'FamilyOtherBlues': (b'\t', 'delta'), 'ForceBold': (b'\x0c\x0e', 'number'), 'ForceBoldThreshold': (b'\x0c\x0f', 'number'), 'LanguageGroup': (b'\x0c\x11', 'number'), 'OtherBlues': (b'\x07', 'delta'), 'StdHW': (b'\n', 'number'), 'StdVW': (b'\x0b', 'number'), 'StemSnapH': (b'\x0c\x0c', 'delta'), 'StemSnapV': (b'\x0c\r', 'delta'), 'Subrs': (b'\x13', 'number'), 'blend': (b'\x17', 'blendList'), 'defaultWidthX': (b'\x14', 'number'), 'initialRandomSeed': (b'\x0c\x13', 'number'), 'lenIV': (b'\x0c\x10', 'number'), 'nominalWidthX': (b'\x15', 'number'), 'vsindex': (b'\x16', 'number')}
setPos(pos, endPos)[source]
getChildren(strings)[source]
arg_SID(s)
arg_array(value)
arg_delta(value)
arg_delta_blend(value)

A delta list with blend lists has to be all blend lists.

The value is a list is arranged as follows:

[
        [V0, d0..dn]
        [V1, d0..dn]
        ...
        [Vm, d0..dn]
]

V is the absolute coordinate value from the default font, and d0-dn are the delta values from the n regions. Each V is an absolute coordinate from the default font.

We want to return a list:

[
        [v0, v1..vm]
        [d0..dn]
        ...
        [d0..dn]
        numBlends
        blendOp
]

where each v is relative to the previous default font value.

arg_number(num)
compile(reason)
getDataLength()
toFile(file)
class fontTools.cffLib.BaseDict(strings=None, file=None, offset=None, isCFF2=None)[source]

Bases: object

decompile(data)[source]
postDecompile()[source]
getCompiler(strings, parent, isCFF2=None)[source]
toXML(xmlWriter)[source]
fromXML(name, attrs, content)[source]
class fontTools.cffLib.TopDict(strings=None, file=None, offset=None, GlobalSubrs=None, cff2GetGlyphOrder=None, isCFF2=None)[source]

Bases: BaseDict

The TopDict represents the top-level dictionary holding font information. CFF2 tables contain a restricted set of top-level entries as described here, but CFF tables may contain a wider range of information. This information can be accessed through attributes or through the dictionary returned through the rawDict property:

font = tt["CFF "].cff[0]
font.FamilyName
# 'Linux Libertine O'
font.rawDict["FamilyName"]
# 'Linux Libertine O'

More information is available in the CFF file’s private dictionary, accessed via the Private property:

tt["CFF "].cff[0].Private.BlueValues
# [-15, 0, 515, 515, 666, 666]
converters = {'BaseFontBlend': <fontTools.cffLib.ArrayConverter object>, 'BaseFontName': <fontTools.cffLib.ASCIIConverter object>, 'CIDCount': <fontTools.cffLib.NumberConverter object>, 'CIDFontRevision': <fontTools.cffLib.NumberConverter object>, 'CIDFontType': <fontTools.cffLib.NumberConverter object>, 'CIDFontVersion': <fontTools.cffLib.NumberConverter object>, 'CharStrings': <fontTools.cffLib.CharStringsConverter object>, 'CharstringType': <fontTools.cffLib.NumberConverter object>, 'Copyright': <fontTools.cffLib.Latin1Converter object>, 'Encoding': <fontTools.cffLib.EncodingConverter object>, 'FDArray': <fontTools.cffLib.FDArrayConverter object>, 'FDSelect': <fontTools.cffLib.FDSelectConverter object>, 'FamilyName': <fontTools.cffLib.Latin1Converter object>, 'FontBBox': <fontTools.cffLib.ArrayConverter object>, 'FontMatrix': <fontTools.cffLib.ArrayConverter object>, 'FontName': <fontTools.cffLib.Latin1Converter object>, 'FullName': <fontTools.cffLib.Latin1Converter object>, 'ItalicAngle': <fontTools.cffLib.NumberConverter object>, 'Notice': <fontTools.cffLib.Latin1Converter object>, 'PaintType': <fontTools.cffLib.NumberConverter object>, 'PostScript': <fontTools.cffLib.ASCIIConverter object>, 'Private': <fontTools.cffLib.PrivateDictConverter object>, 'ROS': <fontTools.cffLib.ROSConverter object>, 'StrokeWidth': <fontTools.cffLib.NumberConverter object>, 'SyntheticBase': <fontTools.cffLib.NumberConverter object>, 'UIDBase': <fontTools.cffLib.NumberConverter object>, 'UnderlinePosition': <fontTools.cffLib.NumberConverter object>, 'UnderlineThickness': <fontTools.cffLib.NumberConverter object>, 'UniqueID': <fontTools.cffLib.NumberConverter object>, 'VarStore': <fontTools.cffLib.VarStoreConverter object>, 'Weight': <fontTools.cffLib.ASCIIConverter object>, 'XUID': <fontTools.cffLib.ArrayConverter object>, 'charset': <fontTools.cffLib.CharsetConverter object>, 'isFixedPitch': <fontTools.cffLib.NumberConverter object>, 'maxstack': <fontTools.cffLib.NumberConverter object>, 'version': <fontTools.cffLib.ASCIIConverter object>}
compilerClass

alias of TopDictCompiler

decompilerClass

alias of TopDictDecompiler

defaults = {'CIDCount': 8720, 'CIDFontRevision': 0, 'CIDFontType': 0, 'CIDFontVersion': 0, 'CharstringType': 2, 'Encoding': 0, 'FontBBox': [0, 0, 0, 0], 'FontMatrix': [0.001, 0, 0, 0.001, 0, 0], 'ItalicAngle': 0, 'PaintType': 0, 'StrokeWidth': 0, 'UnderlinePosition': -100, 'UnderlineThickness': 50, 'isFixedPitch': 0}
order = ['maxstack', 'ROS', 'SyntheticBase', 'version', 'Notice', 'Copyright', 'FullName', 'FontName', 'FamilyName', 'Weight', 'isFixedPitch', 'ItalicAngle', 'UnderlinePosition', 'UnderlineThickness', 'PaintType', 'CharstringType', 'FontMatrix', 'UniqueID', 'FontBBox', 'StrokeWidth', 'XUID', 'PostScript', 'BaseFontName', 'BaseFontBlend', 'CIDFontVersion', 'CIDFontRevision', 'CIDFontType', 'CIDCount', 'charset', 'UIDBase', 'Encoding', 'Private', 'FDSelect', 'FDArray', 'CharStrings', 'VarStore']
getGlyphOrder()[source]

Returns a list of glyph names in the CFF font.

postDecompile()[source]
toXML(xmlWriter)[source]
decompileAllCharStrings()[source]
recalcFontBBox()[source]
decompile(data)
fromXML(name, attrs, content)
getCompiler(strings, parent, isCFF2=None)
class fontTools.cffLib.FontDict(strings=None, file=None, offset=None, GlobalSubrs=None, isCFF2=None, vstore=None)[source]

Bases: BaseDict

defaults = {}
converters = {'BaseFontBlend': <fontTools.cffLib.ArrayConverter object>, 'BaseFontName': <fontTools.cffLib.ASCIIConverter object>, 'CIDCount': <fontTools.cffLib.NumberConverter object>, 'CIDFontRevision': <fontTools.cffLib.NumberConverter object>, 'CIDFontType': <fontTools.cffLib.NumberConverter object>, 'CIDFontVersion': <fontTools.cffLib.NumberConverter object>, 'CharStrings': <fontTools.cffLib.CharStringsConverter object>, 'CharstringType': <fontTools.cffLib.NumberConverter object>, 'Copyright': <fontTools.cffLib.Latin1Converter object>, 'Encoding': <fontTools.cffLib.EncodingConverter object>, 'FDArray': <fontTools.cffLib.FDArrayConverter object>, 'FDSelect': <fontTools.cffLib.FDSelectConverter object>, 'FamilyName': <fontTools.cffLib.Latin1Converter object>, 'FontBBox': <fontTools.cffLib.ArrayConverter object>, 'FontMatrix': <fontTools.cffLib.ArrayConverter object>, 'FontName': <fontTools.cffLib.Latin1Converter object>, 'FullName': <fontTools.cffLib.Latin1Converter object>, 'ItalicAngle': <fontTools.cffLib.NumberConverter object>, 'Notice': <fontTools.cffLib.Latin1Converter object>, 'PaintType': <fontTools.cffLib.NumberConverter object>, 'PostScript': <fontTools.cffLib.ASCIIConverter object>, 'Private': <fontTools.cffLib.PrivateDictConverter object>, 'ROS': <fontTools.cffLib.ROSConverter object>, 'StrokeWidth': <fontTools.cffLib.NumberConverter object>, 'SyntheticBase': <fontTools.cffLib.NumberConverter object>, 'UIDBase': <fontTools.cffLib.NumberConverter object>, 'UnderlinePosition': <fontTools.cffLib.NumberConverter object>, 'UnderlineThickness': <fontTools.cffLib.NumberConverter object>, 'UniqueID': <fontTools.cffLib.NumberConverter object>, 'VarStore': <fontTools.cffLib.VarStoreConverter object>, 'Weight': <fontTools.cffLib.ASCIIConverter object>, 'XUID': <fontTools.cffLib.ArrayConverter object>, 'charset': <fontTools.cffLib.CharsetConverter object>, 'isFixedPitch': <fontTools.cffLib.NumberConverter object>, 'maxstack': <fontTools.cffLib.NumberConverter object>, 'version': <fontTools.cffLib.ASCIIConverter object>}
compilerClass

alias of FontDictCompiler

orderCFF = ['FontName', 'FontMatrix', 'Weight', 'Private']
orderCFF2 = ['Private']
decompilerClass

alias of TopDictDecompiler

setCFF2(isCFF2)[source]
decompile(data)
fromXML(name, attrs, content)
getCompiler(strings, parent, isCFF2=None)
postDecompile()
toXML(xmlWriter)
class fontTools.cffLib.PrivateDict(strings=None, file=None, offset=None, isCFF2=None, vstore=None)[source]

Bases: BaseDict

converters = {'BlueFuzz': <fontTools.cffLib.NumberConverter object>, 'BlueScale': <fontTools.cffLib.NumberConverter object>, 'BlueShift': <fontTools.cffLib.NumberConverter object>, 'BlueValues': <fontTools.cffLib.ArrayConverter object>, 'ExpansionFactor': <fontTools.cffLib.NumberConverter object>, 'FamilyBlues': <fontTools.cffLib.ArrayConverter object>, 'FamilyOtherBlues': <fontTools.cffLib.ArrayConverter object>, 'ForceBold': <fontTools.cffLib.NumberConverter object>, 'ForceBoldThreshold': <fontTools.cffLib.NumberConverter object>, 'LanguageGroup': <fontTools.cffLib.NumberConverter object>, 'OtherBlues': <fontTools.cffLib.ArrayConverter object>, 'StdHW': <fontTools.cffLib.NumberConverter object>, 'StdVW': <fontTools.cffLib.NumberConverter object>, 'StemSnapH': <fontTools.cffLib.ArrayConverter object>, 'StemSnapV': <fontTools.cffLib.ArrayConverter object>, 'Subrs': <fontTools.cffLib.SubrsConverter object>, 'blend': None, 'defaultWidthX': <fontTools.cffLib.NumberConverter object>, 'initialRandomSeed': <fontTools.cffLib.NumberConverter object>, 'lenIV': <fontTools.cffLib.NumberConverter object>, 'nominalWidthX': <fontTools.cffLib.NumberConverter object>, 'vsindex': <fontTools.cffLib.NumberConverter object>}
decompilerClass

alias of PrivateDictDecompiler

compilerClass

alias of PrivateDictCompiler

defaults = {'BlueFuzz': 1, 'BlueScale': 0.039625, 'BlueShift': 7, 'ExpansionFactor': 0.06, 'ForceBold': 0, 'LanguageGroup': 0, 'defaultWidthX': 0, 'initialRandomSeed': 0, 'nominalWidthX': 0}
decompile(data)
fromXML(name, attrs, content)
getCompiler(strings, parent, isCFF2=None)
order = ['vsindex', 'blend', 'BlueValues', 'OtherBlues', 'FamilyBlues', 'FamilyOtherBlues', 'BlueScale', 'BlueShift', 'BlueFuzz', 'StdHW', 'StdVW', 'StemSnapH', 'StemSnapV', 'ForceBold', 'ForceBoldThreshold', 'lenIV', 'LanguageGroup', 'ExpansionFactor', 'initialRandomSeed', 'defaultWidthX', 'nominalWidthX', 'Subrs']
postDecompile()
toXML(xmlWriter)
property in_cff2
getNumRegions(vi=None)[source]
class fontTools.cffLib.IndexedStrings(file=None)[source]

Bases: object

SID -> string mapping.

getCompiler()[source]
getSID(s)[source]
getStrings()[source]
buildStringMapping()[source]