Crate ttf_parser
source ยทExpand description
A high-level, safe, zero-allocation font parser for:
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ยง
- aat ๐A collection of Apple Advanced Typography related types.
- 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 Color Bitmap Location Table implementation.
- A Compact Font Format Table implementation.
- A Compact Font Format 2 Table implementation.
- A Character to Glyph Index Mapping Table implementation.
- A Color Table implementation.
- A Color Palette Table implementation.
- delta_
set ๐ - A Feature Name Table implementation.
- A Font Variations Table implementation.
- A Glyph Definition Table implementation.
- ggg ๐Common data types used by GDEF/GPOS/GSUB tables.
- A Glyph Data Table implementation.
- A Glyph Positioning Table implementation.
- A Glyph Substitution Table implementation.
- A Glyph Variations Table implementation.
- A Font Header Table implementation.
- A Horizontal Header Table implementation.
- A Horizontal/Vertical Metrics Table implementation.
- A Horizontal Metrics Variations Table implementation.
- A Kerning Table implementation.
- An Extended Kerning Table implementation.
- language ๐
- An Index to Location Table implementation.
- A Math Table implementation.
- A Maximum Profile Table implementation.
- An Extended Glyph Metamorphosis Table implementation.
- A Metrics Variations Table implementation.
- A Naming Table implementation.
- A list of name IDโs.
- This module contains OpenType Layout supplementary tables implementation.
- A OS/2 and Windows Metrics Table implementation.
- parser ๐Binary parsing utils.
- A PostScript Table implementation.
- A Standard Bitmap Graphics Table implementation.
- A Style Attributes Table implementation.
- An SVG Table implementation.
- tables ๐
- A Tracking Table implementation.
- var_
store ๐Implementation of Item Variation Store - A Vertical Header Table implementation.
- A Vertical Origin Table implementation.
- A Vertical Metrics Variations Table implementation.
Structsยง
- Dummy
Outline ๐ - 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.
- Phantom points.
- A float point.
- A glyphโs raster image.
- A raw font face.
- A list of all supported tables as raw data.
- A rectangle.
- A rectangle described by the left-lower and upper-right points.
- A RGBA color in the sRGB color space.
- A script metrics used by subscript and superscript.
- A raw table record.
- A 4-byte tag.
- An affine transform.
- VarCoords ๐
- 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
Name
language. - Magic ๐A TrueType font magic.
- Face permissions.
- A platform ID.
- A glyph raster image format.
- A face style.
- A face weight.
- A face width.
Constantsยง
- MAX_
VAR_ ๐COORDS
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.