Namespace FontIo

IO Procedures

FontIo.readFont<GS extends Data.Order<Ot.Glyph>>(sfnt,​gsf,​config?):​Ot.Font<GS>
· sfnt:Ot.Sfnt SFNT to parse
· gsf:Data.OrderStoreFactoryWithDefault<Ot.Glyph,​GS> Factory to create a glyph store
· config?:FontIo.FontIoConfig IO configuration

Creates a Ot.Font form a Ot.Sfnt. The parameter gsf is used to provide the glyph store factory to create the glyph store. When using with Ot.ListGlyphStore, Ot.ListGlyphStoreFactory is recommended to be provided for gsf parameter.

FontIo.writeFont<GS extends Data.Order<Ot.Glyph>>(font,​config?):​Ot.Sfnt
· font:Ot.Font<GS> The font to write
· config?:FontIo.FontIoConfig IO configuration

Creates a Ot.Sfnt form a Ot.Font.

FontIo.readSfntOtf(buffer:Buffer):​Ot.Sfnt

Creates a Ot.Sfnt form a Buffer.

FontIo.writeSfntOtf(sfnt:Ot.Sfnt):​Buffer

Creates a Buffer form a Ot.Sfnt.

FontIo.writeSfntOtfFromTableSlices(sfnt:FontIo.TableSliceCollection):​Buffer

Creates a Buffer form a Ot.TableSliceCollection.

FontIo.readSfntTtc(buffer:Buffer):​Ot.Sfnt[]

Creates a Ot.Sfnt array form a Buffer representing a TTC file.

FontIo.writeSfntTtc(sfnt:Ot.Sfnt[]):​Buffer

Creates a TTC file Buffer form a Ot.Sfnt array.

FontIo.writeSfntTtcFromTableSlices(sfnt:Ot.TableSliceCollection[]):​Buffer

Creates a TTC file Buffer form a FontIo.TableSliceCollection array.

Table Slice Collection

Datatype FontIo.TableSliceCollection

Properties

Datatype FontIo.TableSlice

Properties

IO Configuration

Datatype FontIo.FontIoConfig

Members

  • glyphStore?:

    • statOs2XAvgCharWidth?:​boolean

      Whether to recalculate xAvgCharWidth property in OS/2 table when writing fonts. Defaults to true.

  • cff?:

    • doLocalOptimization?:​boolean

      Whether to perform local optimization when writing the CFF/CFF2 table. Defaults to true.

    • doGlobalOptimization?:​boolean

      Whether to perform global optimization when writing the CFF/CFF2 table. Defaults to true.

  • ttf?:

    • gvarOptimizeTolerance?:​boolean

      The error tolerance when writing the gvar table. Defaults to 1/128. With higher tolerance the gvar table writer would do more aggressive IUP optimization.

    • gvarForceProduceGVD?:​boolean

      When building gvar, force production of glyph variation data, even if the glyph has no variation.

    • gvarForceZeroGapsBetweenGVD?:​boolean

      When building gvar, force a 4-byte zero gap between each glyph variation data.

  • encoding?:

    • statOs2UnicodeRanges?:​boolean

      Whether to recalculate ulUnicodeRange1 ... ulUnicodeRange4 property in OS/2 table when writing fonts. Defaults to true.

    • forceCmapSubtableFormatToBePresent?:​boolean

      Whether to force a cmap format 4 subtable to be present even if it is empty or non-buildable (i.e. when all characters are mapped to exactly the same glyph). Under those situations, a “stub” cmap format 4 subtable containing no mapping will be created. Defaults to true.

  • glyphNaming?:

  • layout?:

    • gdefWriteTrick?:​number
    • lookupWriteTricks?:​Map<Ot.GsubGpos.LookupProp,​number>

      Specific options to control writing behavior when writing GDEF table, and GSUB / GPOS lookups, to provide platform-specific optimizations. The number is a flag-field and could be assigned as:

      • 0x0001: Avoid lookup being lifted as an extension lookup;
      • 0x0002: Force single substitution and single position lookups to form one single subtable;
      • 0x0004: Force lookups to use flat (format 1) coverage table;
      • 0x0008: Force lookups to use coverage tables and class-def tables with less items instead of smaller footprint;
      • 0x0010: Force contextual lookups to become chaining (could be used to workaround certain Apple shaping engine's bugs);
  • extPrivate?:

  • vttPrivate?:

  • generateDummyDigitalSignature?:​boolean

    Whether generate an 8-byte dummy digital signature (DSIG table) to the final SFNT.