Expand description

A high-level, safe, zero-allocation TrueType font parser.

Supports TrueType, OpenType and AAT fonts.

Font parsing starts with a Face.

Features

  • A high-level API for most common properties, hiding all parsing and data resolving logic.
  • A low-level, but safe API to access TrueType tables data.
  • Highly configurable. You can disable most of the features, reducing binary size. You can also parse TrueType tables separately, without loading the whole font/face.
  • Zero heap allocations.
  • Zero unsafe.
  • Zero dependencies.
  • no_std/WASM compatible.
  • Fast.
  • Stateless. All parsing methods are immutable.
  • Simple and maintainable code (no magic numbers).

Safety

  • The library must not panic. Any panic considered as a critical bug and should be reported.
  • The library forbids unsafe code.
  • No heap allocations, so crash due to OOM is not possible.
  • All recursive methods have a depth limit.
  • Technically, should use less than 64KiB of stack in worst case scenario.
  • Most of arithmetic operations are checked.
  • Most of numeric casts are checked.

Modules

An Anchor Point Table implementation.
This module contains Apple Advanced Typography Layout supplementary tables implementation.
An Axis Variations Table implementation.
A Color Bitmap Data Table implementation.
A Feature Name Table implementation.
A Font Variations Table implementation.
A Glyph Definition Table implementation.
A Glyph Data Table implementation.
A Glyph Positioning Table implementation.
A Glyph Variations Table implementation.
A Font Header Table implementation.
A Horizontal Header Table implementation.
A Kerning Table implementation.
An Extended Kerning Table implementation.
An Index to Location Table implementation.
A Math Table implementation.
A Maximum Profile Table implementation.
A Naming Table implementation.
A list of name ID’s.
This module contains OpenType Layout supplementary tables implementation.
A PostScript Table implementation.
An SVG Table implementation.
A Tracking Table implementation.
A Vertical Header Table implementation.
A Vertical Origin Table implementation.

Structs

A font face.
Parsed face tables.
A 32-bit signed fixed-point number (16.16).
A type-safe wrapper for glyph ID.
A slice-like container that converts internal binary data only on access.
A slice-like container that converts internal binary data only on access.
An iterator over LazyArray16.
An iterator over LazyArray32.
A line metrics.
A variation coordinate in a normalized coordinate system.
A glyph’s raster image.
A raw font face.
A list of all supported tables as raw data.
A rectangle.
A script metrics used by subscript and superscript.
A raw table record.
A 4-byte tag.
A font variation value.

Enums

A list of errors that can occur during a CFF glyph outlining.
A list of font face parsing errors.
A glyph raster image format.
A face style.
A face weight.
A face width.

Traits

A trait for parsing raw binary data of fixed size.
A trait for glyph outline construction.

Functions

Returns the number of fonts stored in a TrueType font collection.