Skip to main content

Crate oxideav_ttf

Crate oxideav_ttf 

Source
Expand description

Pure-Rust TrueType / OpenType font parser.

Round-1 scope:

  • sfnt + table directory walker (parser).
  • Core OpenType tables: head, hhea, maxp, cmap (base formats 0/4/6/12 + format 14 Unicode Variation Sequences as a sidecar), name, OS/2, hmtx, loca, glyf (simple + composite), post.
  • Legacy kern table (format 0 subtable).
  • GSUB LookupType 1 (single substitution: positional forms, small-caps, vertical alternates), LookupType 2 (multiple substitution — split one input glyph into N), LookupType 3 (alternate substitution — aalt / salt per-coverage alternates), LookupType 4 (ligature substitution — both walker and lookup-index-specific entry points), LookupType 5 (contextual substitution — formats 1 / 2 / 3), LookupType 6 (chained contexts substitution — formats 1 / 2 / 3, with recursive sub-lookup dispatch), and LookupType 8 (reverse chained context single substitution), discoverable via the ScriptList / FeatureList / LookupList common-table walk.
  • GPOS LookupType 1 (single adjustment), LookupType 2 (pair-adjustment / kerning), LookupType 3 (cursive attachment), LookupType 4 (mark-to-base attachment for diacritics), LookupType 5 (mark-to-ligature attachment), LookupType 6 (mark-to-mark attachment for stacked diacritics), LookupType 7 (contextual positioning — SequenceContext formats 1/2/3 with recursive nested-lookup dispatch), and LookupType 8 (chained contexts positioning).
  • GDEF (glyph class definitions).
  • Adobe Glyph List (AGL) glyph-name → Unicode resolution: glyph_name_to_codepoints / glyph_name_to_char (direct table lookup against the staged AGL data).
  • gasp (grid-fitting and scan-conversion procedure table, ISO/IEC 14496-22:2019 §5.3.7) — both version 0 and 1, per-record flag accessors, behaviour-for-ppem lookup.

The crate is read-only (parsing-only) and dependency-light: only oxideav-core for shared types. CFF/Type 2 charstrings live in the sibling oxideav-otf crate. TrueType hinting, bidi, and complex shaping are deferred to later rounds.

Variable fonts (fvar/avar/gvar) are supported as of round 4: see Font::variation_axes, Font::named_instances, Font::set_variation_coords, and Font::glyph_outline (which applies gvar deltas via the current axis-coord vector when set).

See README.md for the public API tour.

Re-exports§

pub use agl::glyph_name_to_char;
pub use agl::glyph_name_to_codepoints;
pub use collection::is_collection;
pub use collection::CollectionHeader;
pub use collection::TTC_MAGIC;
pub use shape::ShapedGlyph;
pub use outline::BBox;
pub use outline::Contour;
pub use outline::Point;
pub use outline::TtOutline;
pub use tables::cbdt::ColorBitmap;
pub use tables::cblc::BigGlyphMetrics;
pub use tables::cblc::SmallGlyphMetrics;
pub use tables::colr::Affine2x3;
pub use tables::colr::ClipBox;
pub use tables::colr::ColorLayer;
pub use tables::colr::ColorLine;
pub use tables::colr::ColorStop;
pub use tables::colr::CompositeMode;
pub use tables::colr::Extend;
pub use tables::colr::Paint;
pub use tables::colr::PaintRef;
pub use tables::dsig::Signature as DsigSignature;
pub use tables::dsig::DSIG_BLOCK_FORMAT_PKCS7;
pub use tables::dsig::DSIG_VERSION;
pub use tables::ebdt::CompositeBitmap;
pub use tables::ebdt::EbdtComponent;
pub use tables::ebdt::GrayBitmap;
pub use tables::ebsc::BitmapScale;
pub use tables::ebsc::SbitLineMetrics;
pub use tables::ebsc::EBSC_MAJOR_VERSION;
pub use tables::ebsc::EBSC_MINOR_VERSION;
pub use tables::fvar::NamedInstance;
pub use tables::fvar::VariationAxis;
pub use tables::gasp::GaspRange;
pub use tables::gasp::GASP_DOGRAY;
pub use tables::gasp::GASP_GRIDFIT;
pub use tables::gasp::GASP_PPEM_SENTINEL;
pub use tables::gasp::GASP_RESERVED_MASK;
pub use tables::gasp::GASP_SYMMETRIC_GRIDFIT;
pub use tables::gasp::GASP_SYMMETRIC_SMOOTHING;
pub use tables::gasp::GASP_TABLE_TAG;
pub use tables::gasp::GASP_VERSION_0;
pub use tables::gasp::GASP_VERSION_1;
pub use tables::gpos::CursiveAttachment;
pub use tables::gpos::GposFeature;
pub use tables::gpos::PosRecord;
pub use tables::gpos::PosValue;
pub use tables::gsub::GsubFeature;
pub use tables::hdmx::HdmxRecord;
pub use tables::hdmx::HDMX_TABLE_TAG;
pub use tables::hdmx::HDMX_VERSION_0;
pub use tables::head::HEAD_FLAG_BASELINE_AT_Y0;
pub use tables::head::HEAD_FLAG_CLEARTYPE_OPTIMIZED;
pub use tables::head::HEAD_FLAG_CONVERTED;
pub use tables::head::HEAD_FLAG_INSTRUCTIONS_ALTER_ADVANCE;
pub use tables::head::HEAD_FLAG_LAST_RESORT;
pub use tables::head::HEAD_FLAG_LOSSLESS;
pub use tables::head::MAC_STYLE_BOLD;
pub use tables::head::MAC_STYLE_CONDENSED;
pub use tables::head::MAC_STYLE_EXTENDED;
pub use tables::head::MAC_STYLE_ITALIC;
pub use tables::kern::HeaderVariant as KernHeaderVariant;
pub use tables::ltsh::LTSH_ALWAYS_LINEAR;
pub use tables::ltsh::LTSH_TABLE_TAG;
pub use tables::ltsh::LTSH_VERSION_0;
pub use tables::merg::MergeEntry;
pub use tables::merg::GROUP_LTR;
pub use tables::merg::GROUP_RTL;
pub use tables::merg::MERGE_LTR;
pub use tables::merg::MERGE_RTL;
pub use tables::merg::SECOND_IS_SUBORDINATE_LTR;
pub use tables::merg::SECOND_IS_SUBORDINATE_RTL;
pub use tables::meta::is_valid_meta_tag;
pub use tables::meta::script_lang_tags;
pub use tables::meta::MetaRecord;
pub use tables::meta::ScriptLangTag;
pub use tables::meta::META_TABLE_TAG;
pub use tables::meta::META_TAG_APPL;
pub use tables::meta::META_TAG_BILD;
pub use tables::meta::META_TAG_DLNG;
pub use tables::meta::META_TAG_SLNG;
pub use tables::meta::META_VERSION_1;
pub use tables::name::name_id;
pub use tables::name::platform;
pub use tables::name::NameRecord;
pub use tables::os2::FSSELECTION_BOLD;
pub use tables::os2::FSSELECTION_ITALIC;
pub use tables::os2::FSSELECTION_OBLIQUE;
pub use tables::os2::FSSELECTION_REGULAR;
pub use tables::os2::FSSELECTION_USE_TYPO_METRICS;
pub use tables::os2::FSTYPE_BITMAP_ONLY;
pub use tables::os2::FSTYPE_EDITABLE;
pub use tables::os2::FSTYPE_NO_SUBSETTING;
pub use tables::os2::FSTYPE_PREVIEW_PRINT;
pub use tables::os2::FSTYPE_RESTRICTED_LICENSE;
pub use tables::pclt::PCLT_MAJOR_VERSION;
pub use tables::pclt::PCLT_STROKE_WEIGHT_RANGE;
pub use tables::pclt::PCLT_TABLE_TAG;
pub use tables::pclt::PCLT_WIDTH_TYPE_RANGE;
pub use tables::post::standard_mac_glyph_name;
pub use tables::post::GlyphNameRef;
pub use tables::post::PostFormat;
pub use tables::post::PostV20;
pub use tables::post::PostV25;
pub use tables::post::POST_TABLE_TAG;
pub use tables::post::POST_VERSION_10;
pub use tables::post::POST_VERSION_20;
pub use tables::post::POST_VERSION_25;
pub use tables::post::POST_VERSION_30;
pub use tables::post::RECOMMENDED_GLYPH_NAME_MAX_LEN;
pub use tables::post::STANDARD_MAC_GLYPH_COUNT;
pub use tables::post::STANDARD_MAC_GLYPH_NAMES;
pub use tables::sbix::SbixGlyph;
pub use tables::sbix::MAX_DUPE_DEPTH as SBIX_MAX_DUPE_DEPTH;
pub use tables::stat::AxisRecord as StatAxisRecord;
pub use tables::stat::AxisValue as StatAxisValue;
pub use tables::stat::FLAG_ELIDABLE_AXIS_VALUE_NAME as STAT_FLAG_ELIDABLE_AXIS_VALUE_NAME;
pub use tables::stat::FLAG_OLDER_SIBLING_FONT_ATTRIBUTE as STAT_FLAG_OLDER_SIBLING_FONT_ATTRIBUTE;
pub use tables::stat::RANGE_MAX_POS_INFINITY as STAT_RANGE_MAX_POS_INFINITY;
pub use tables::stat::RANGE_MIN_NEG_INFINITY as STAT_RANGE_MIN_NEG_INFINITY;
pub use tables::svg::SvgDocument;
pub use tables::svg::SVG_GZIP_MAGIC;
pub use tables::svg::SVG_TABLE_TAG;
pub use tables::svg::SVG_VERSION_0;
pub use tables::vdmx::RatioRange as VdmxRatioRange;
pub use tables::vdmx::VdmxGroup;
pub use tables::vdmx::VdmxVTableRecord;
pub use tables::vdmx::VDMX_TABLE_TAG;
pub use tables::vdmx::VDMX_VERSION_0;
pub use tables::vdmx::VDMX_VERSION_1;
pub use tables::vhea::VHEA_VERSION_1_0;
pub use tables::vhea::VHEA_VERSION_1_1;
pub use tables::vorg::VertOriginEntry;
pub use tables::vorg::VORG_MAJOR_VERSION;
pub use tables::vorg::VORG_MINOR_VERSION;

Modules§

agl
Adobe Glyph List (AGL) — glyph-name → Unicode resolution.
collection
TrueType Collection (.ttc / .ttcf) header parser.
outline
TrueType outline data structures and helpers.
shape
OpenType GSUB/GPOS shaping pipeline.
tables
OpenType table parsers.

Structs§

Font
A parsed TrueType / OpenType font, lifetime-bound to the input bytes.

Enums§

Error
Errors emitted during font parsing or glyph lookup.