Cargo Features

ttf-parser = { version = "0.20.0", default-features = false, features = ["std", "variable-fonts", "opentype-layout", "apple-layout", "glyph-names", "gvar-alloc"] }
default = apple-layout, glyph-names, opentype-layout, std, variable-fonts

These default features are set whenever ttf-parser is added without default-features = false somewhere in the dependency tree.

std default gvar-alloc?

Affects cff::f32_abs

variable-fonts default

Enables variable fonts support. Increases binary size almost twice.
Includes avar, CFF2, fvar, gvar, HVAR, MVAR and VVAR tables.

Affects layout_table::LayoutTable.variations, ttf-parser::RawFaceTables.avar, ttf-parser::RawFaceTables.cff2, ttf-parser::RawFaceTables.fvar, ttf-parser::RawFaceTables.gvar, ttf-parser::RawFaceTables.hvar, ttf-parser::RawFaceTables.mvar, ttf-parser::FaceTables.avar, ttf-parser::FaceTables.cff2, ttf-parser::FaceTables.fvar, ttf-parser::FaceTables.gvar, ttf-parser::FaceTables.hvar, ttf-parser::FaceTables.mvar, cff::cff2, tables::avar, tables::fvar, tables::gvar, tables::hvar, tables::mvar

opentype-layout default

Enables GDEF, GPOS, GSUB and MATH tables.

Affects ttf-parser::opentype_layout, ttf-parser::RawFaceTables.gdef, ttf-parser::RawFaceTables.gpos, ttf-parser::RawFaceTables.gsub, ttf-parser::RawFaceTables.math, ttf-parser::FaceTables.gdef, ttf-parser::FaceTables.gpos, ttf-parser::FaceTables.gsub, ttf-parser::FaceTables.math, tables::gdef, tables::gpos, tables::gsub, tables::math

apple-layout default

Enables ankr, feat, format1 subtable in kern, kerx, morx and trak tables.

Affects ttf-parser::apple_layout, ttf-parser::RawFaceTables.ankr, ttf-parser::RawFaceTables.feat, ttf-parser::RawFaceTables.kerx, ttf-parser::RawFaceTables.morx, ttf-parser::RawFaceTables.trak, ttf-parser::FaceTables.ankr, ttf-parser::FaceTables.feat, ttf-parser::FaceTables.kerx, ttf-parser::FaceTables.morx, ttf-parser::FaceTables.trak, tables::ankr, tables::feat, tables::kerx, tables::morx, tables::trak

glyph-names default

Enables glyph name query via Face::glyph_name. TrueType fonts do not store default glyph names, to reduce file size, which means we have to store them in ttf-parser. And there are almost 500 of them. By disabling this feature a user can reduce binary size a bit.

gvar-alloc = std

Enables heap allocations during gvar table parsing used by Apple's variable fonts.
Due to the way gvar table is structured, we cannot avoid allocations.
By default, only up to 32 variable tuples will be allocated on the stack,
while the spec allows up to 4095. Most variable fonts use 10-20 tuples,
so our limit is suitable for most of the cases. But if you need full support, you have to enable this feature.