Skip to main content

Crate oxideav_scribe

Crate oxideav_scribe 

Source
Expand description

Pure-Rust font shaper + layout for the oxideav framework.

Scribe is a vector-only shaper: parse TTF / OTF tables → emit positioned vector glyphs as oxideav_core::Nodes. All pixel work — outline flattening, scanline anti-aliasing, alpha compositing — happens downstream in oxideav-raster.

Scope:

  • Shapercmap + GSUB type 4 (ligatures) + GPOS type 2 (pair kerning) + mark-to-base / mark-to-mark, enough for Latin / Cyrillic / Greek / basic CJK / Vietnamese / polytonic Greek.
  • Arabic contextual joining (round 7)shaping::arabic computes the joining form per character using the Unicode joining classes + an adjacency state machine; FaceChain::shape then translates Arabic letters into their Arabic Presentation Forms-B equivalents (U+FE70..U+FEFF) before cmap, so a font that ships the PF-B block (DejaVuSans, Noto Sans Arabic, Amiri) renders visually-correct contextual shapes — including LAM-ALEF ligatures via the existing GSUB pass.
  • Indic + Brahmic complex-script shaping (rounds 8 + 10 + 11 + 12)shaping::indic classifies Devanagari (U+0900..U+097F), Bengali (U+0980..U+09FF), Tamil (U+0B80..U+0BFF), Gurmukhi (U+0A00..U+0A7F), Gujarati (U+0A80..U+0AFF), Telugu (U+0C00..U+0C7F), Kannada (U+0C80..U+0CFF), Malayalam (U+0D00..U+0D7F), Oriya (U+0B00..U+0B7F), Sinhala (U+0D80..U+0DFF), Khmer (U+1780..U+17FF), and Thai (U+0E00..U+0E7F) codepoints into syllabic categories, segments runs into orthographic clusters, and applies per-script cluster transformations: pre-base matra reorder (a uniform mechanism across all scripts that have one) plus reph identification (the Indic core scripts; Tamil + Malayalam + Sinhala + Khmer + Thai are reph-disabled). Khmer’s halant role is played by U+17D2 COENG which stacks subjoined consonants underneath the base; Thai has no halant and Thai pre-base vowels are already in storage order before their consonant. The FaceChain::shape pipeline applies the reorder before cmap so cmap-only fonts render simple clusters with the matra in the correct visual position. When the active face publishes a rphf GSUB lookup for the script, identified reph clusters get the leading RA glyph substituted to its reph-form and the halant glyph dropped via Font::gsub_apply_lookup_type_1.
  • Face::glyph_path / glyph_node — TrueType + OTF (CFF) outlines as oxideav_core::Path; CBDT/sbix colour bitmaps as Node::Image carrying a VideoFrame.
  • Shaper::shape_to_paths — vector text API: positioned (face_idx, Node, Transform2D) triples ready to compose into a VectorFrame. Each glyph is wrapped in a cache-keyed Group so the downstream rasterizer’s bitmap cache reuses the same memoised glyph across renders.
  • Face chain — multi-face fallback (primary → fallback chain), per-codepoint resolution.
  • Layout — line measurement + word-wrap (no bidi).

See README.md for a tour and the deferral list.

Re-exports§

pub use color::Rgba;
pub use color::TRANSPARENT;
pub use color::WHITE;
pub use color_glyph::ColorGlyphBitmap;
pub use face::Face;
pub use face::FaceKind;
pub use face_chain::FaceChain;
pub use layout::run_width;
pub use layout::wrap_lines;
pub use shaper::PositionedGlyph;
pub use shaper::Shaper;
pub use shaper::ShaperBuilder;
pub use shaping::bengali_category;
pub use shaping::bengali_feature_tags;
pub use shaping::cluster_boundaries;
pub use shaping::cluster_boundaries_with;
pub use shaping::compute_forms;
pub use shaping::devanagari_category;
pub use shaping::devanagari_feature_tags;
pub use shaping::feature_tags_for_run;
pub use shaping::gujarati_category;
pub use shaping::gujarati_feature_tags;
pub use shaping::gurmukhi_category;
pub use shaping::gurmukhi_feature_tags;
pub use shaping::joining_class;
pub use shaping::kannada_category;
pub use shaping::kannada_feature_tags;
pub use shaping::khmer_category;
pub use shaping::khmer_feature_tags;
pub use shaping::malayalam_category;
pub use shaping::malayalam_feature_tags;
pub use shaping::oriya_category;
pub use shaping::oriya_feature_tags;
pub use shaping::presentation_form;
pub use shaping::reorder_cluster;
pub use shaping::reorder_cluster_with;
pub use shaping::script_indic_tags;
pub use shaping::sinhala_category;
pub use shaping::sinhala_feature_tags;
pub use shaping::tamil_category;
pub use shaping::tamil_feature_tags;
pub use shaping::telugu_category;
pub use shaping::telugu_feature_tags;
pub use shaping::thai_category;
pub use shaping::thai_feature_tags;
pub use shaping::ClusterFlags;
pub use shaping::IndicCategory;
pub use shaping::JoiningClass;
pub use shaping::JoiningForm;
pub use shaping::ReorderRules;
pub use shaping::Script;
pub use shaping::BENGALI_RULES;
pub use shaping::DEVANAGARI_RULES;
pub use shaping::GUJARATI_RULES;
pub use shaping::GURMUKHI_RULES;
pub use shaping::KANNADA_RULES;
pub use shaping::KHMER_RULES;
pub use shaping::MALAYALAM_RULES;
pub use shaping::ORIYA_RULES;
pub use shaping::SINHALA_RULES;
pub use shaping::TAMIL_RULES;
pub use shaping::TELUGU_RULES;
pub use shaping::THAI_RULES;
pub use style::synthetic_italic_shear;
pub use style::Style;
pub use style::DEFAULT_SYNTHETIC_ITALIC_DEG;
pub use style::ITALIC_ANGLE_EPSILON_DEG;

Modules§

color
Small colour primitives used by the rasterizer + composer.
color_glyph
Color-glyph rasterizer — bridges oxideav_ttf::ColorBitmap (raw CBDT PNG bytes + per-glyph metrics) to a straight-alpha RGBA8 buffer.
face
Face — owning wrapper around oxideav_ttf::Font / oxideav_otf::Font plus per-face identity for the glyph-bitmap cache.
face_chain
FaceChain — ordered list of faces consulted in priority order when shaping. Round-2 fallback support: when the primary face doesn’t have a glyph for a codepoint, the chain walks down the list until one does, falling back to the primary’s .notdef only if no face provides a glyph.
layout
Single-line measurement + word-wrap helpers for round-1.
shaper
Text shaper: cmap → ligature substitution → pair kerning → mark-to-base attachment → mark-to-mark stacking.
shaping
Script-aware shaping helpers layered on top of the cmap → GSUB → GPOS pipeline in crate::shaper.
style
Font request style — italic knob the shaper honours when emitting glyph paths.

Structs§

NamedInstance
One named instance (a pre-defined coordinate vector).
VariationAxis
One variation axis as published in the font’s fvar table. All values are in user-space units (Fixed 16.16 scaled to f32 here).

Enums§

Error
Errors emitted by the scribe pipeline.