Expand description
Embedded TrueType faces + shaping.
EmbeddedFont holds a bundled TTF’s bytes plus a pre-parsed
rustybuzz::Face and the FontDescriptor-relevant metrics the PDF
emit path needs. shape runs rustybuzz over a UTF-8 string and
returns a ShapedGlyph stream with GPOS advances and offsets
preserved. subset reduces a face to just the glyph IDs used in
one document and returns the trimmed bytes suitable for a
/FontFile2 stream.
Structs§
- Embedded
Font - A bundled
TrueTypeface: the raw bytes plus the metrics and parsedrustybuzz::Faceneeded to shape text and emit a PDFFontDescriptor. - Shaped
Glyph - One glyph in a shaped run. Cluster values are byte offsets into the source UTF-8 string.
- Subset
Error - Wraps [
subsetter::Error] without exposing the dependency in the public API. The PDF emit path bails on this error with aDiagnostic. The inner variant is private: callers debug via theDisplay/Debugimpls, not pattern matching onsubsetter::Errordirectly.
Functions§
- shape
- Shape
textagainstfontusingrustybuzz. Returns the glyph stream in visual order (LTR for this slice). Glyph IDs, advances, and offsets come fromrustybuzz, so substitutions, kerning, and combining-mark positioning are preserved. An emptytextreturns an emptyVecwithout invoking the shaper. - subset
- Subset
fontto just the glyph IDs ingids(always include GID 0,.notdef, which the PDF spec mandates). Returns the trimmed TTF bytes suitable for embedding as a/FontFile2stream.
Type Aliases§
- Shape
Plan 🔒Cache - Per-face cache of compiled
rustybuzzshape plans, keyed by the(script, language)a buffer resolves to after segment-property guessing.Arcso the hit path can clone the handle out and shape with the lock released.