# merger

Merge OpenType Layout tables (GDEF / GPOS / GSUB).

class fontTools.varLib.merger.AligningMerger(font=None)
  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeTables(font, master_ttfs, tableTags)
  mergeThings(out, lst)
  classmethod merger(clazzes, attrs=(None,))
  mergers = {<class 'fontTools.ttLib.tables.otTables.GDEF'>: {'GlyphClassDef': <function merge>}, <class 'fontTools.ttLib.tables.otBase.ValueRecord'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Anchor'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.SinglePos'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.PairSet'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.PairPos'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.MarkBasePos'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.MarkMarkPos'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Lookup'>: {None: <function merge>}}
  classmethod mergersFor(thing, _default={})

class fontTools.varLib.merger.COLRVariationMerger(model, axisTags, font, allowLayerReuse=True)

  A specialized VariationMerger that takes multiple master fonts containing COLRv1 tables, and builds a variable COLR font.

  COLR tables are special in that variable subtables can be associated with multiple delta-set indices (via VarIndexBase). They also contain tables that must change their type (not simply the Format) as they become variable (e.g. Affine2x3 -> VarAffine2x3) so this merger takes care of that too.

  checkFormatEnum(out, lst, validate=<function COLRVariationMerger.<lambda>>)
  classmethod convertSubTablesToVarType(table)
  static expandPaintColrLayers(colr)

    Rebuild LayerList without PaintColrLayers reuse.

    Each base paint graph is fully DFS-traversed (with exception of PaintColrGlyph which are irrelevant for this); any layers referenced via PaintColrLayers are collected into a new LayerList and duplicated when reuse is detected, to ensure that all paints are distinct objects at the end of the process. PaintColrLayers’s FirstLayerIndex/NumLayers are updated so that no overlap is left. Also, any consecutively nested PaintColrLayers are flattened. The COLR table’s LayerList is replaced with the new unique layers. A side effect is also that any layer from the old LayerList which is not referenced by any PaintColrLayers is dropped.

  mergeAttrs(out, lst, attrs)
  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeSparseDict(out, lst)
  mergeTables(font, master_ttfs, tableTags=('COLR',))
  mergeThings(out, lst)
  mergeVariableAttrs(out, lst, attrs) → int
  classmethod merger(clazzes, attrs=(None,))
  mergers = {<class 'fontTools.ttLib.tables.otTables.BaseGlyphList'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.LayerList'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Paint'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.ClipBox'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Affine2x3'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.ColorStop'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.ColorLine'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.ClipList'>: {'clips': <function merge>}}
  classmethod mergersFor(thing, _default={})
  setModel(model)
  storeMastersForAttr(out, lst, attr)
  storeVariationIndices(varIdxes) → int

class fontTools.varLib.merger.InstancerMerger(font, model, location)

  A merger that takes multiple master fonts, and instantiates an instance.

  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeTables(font, master_ttfs, tableTags)
  mergeThings(out, lst)
  classmethod merger(clazzes, attrs=(None,))
  mergers = {<class 'fontTools.ttLib.tables.otTables.CaretValue'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Anchor'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otBase.ValueRecord'>: {None: <function merge>}}
  classmethod mergersFor(thing, _default={})

class fontTools.varLib.merger.Merger(font=None)
  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeTables(font, master_ttfs, tableTags)
  mergeThings(out, lst)
  classmethod merger(clazzes, attrs=(None,))
  classmethod mergersFor(thing, _default={})

class fontTools.varLib.merger.MutatorMerger(font, instancer, deleteVariations=True)

  A merger that takes a variable font, and instantiates an instance. While there’s no “merging” to be done per se, the operation can benefit from many operations that the aligning merger does.

  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeTables(font, master_ttfs, tableTags)
  mergeThings(out, lst)
  classmethod merger(clazzes, attrs=(None,))
  mergers = {<class 'fontTools.ttLib.tables.otTables.CaretValue'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Anchor'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otBase.ValueRecord'>: {None: <function merge>}}
  classmethod mergersFor(thing, _default={})

class fontTools.varLib.merger.VariationMerger(model, axisTags, font)

  A merger that takes multiple master fonts, and builds a variable font.

  mergeLists(out, lst)
  mergeObjects(out, lst, exclude=())
  mergeTables(font, master_ttfs, tableTags)
  mergeThings(out, lst)
  classmethod merger(clazzes, attrs=(None,))
  mergers = {<class 'fontTools.ttLib.tables.otTables.BaseCoord'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.CaretValue'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otTables.Anchor'>: {None: <function merge>}, <class 'fontTools.ttLib.tables.otBase.ValueRecord'>: {None: <function merge>}}
  classmethod mergersFor(thing, _default={})
  setModel(model)

fontTools.varLib.merger.buildVarDevTable(store_builder, master_values)