Expand description
Typography and text layout for Martensite.
This crate provides:
font: font system abstraction, system font discovery viafontdb, and custom font asset loading.shaping: complex text shaping with BiDi, line breaking, and font fallback via cosmic-text.cache: two-tier text measurement and glyph shaping cache (Tier 1 inline inColdNode, Tier 2 global LRU with 16 MB budget).ime: velocity-damped kinetic IME candidate positioning that tracks the caret during active scrolling.
§IME candidate projection
The compute_ime_bounds function computes IME candidate window
bounds from the cursor position and line height. For scrolling
containers, prefer the ime module’s ImePositioner, which
applies velocity-damped projection and viewport clamping.
Re-exports§
pub use cache::CachedShape;pub use cache::FontSizeBits;pub use cache::LineHeightBits;pub use cache::MaxWidthBits;pub use cache::ShapeCacheKey;pub use cache::TextHash;pub use cache::TextShapeCache;pub use cache::DEFAULT_MEMORY_BUDGET;pub use font::FontFaceInfo;pub use font::FontId;pub use font::FontManager;pub use font::FontSource;pub use font::FontStyle;pub use ime::ImePositioner;pub use ime::ScrollKinematics;pub use ime::Viewport;pub use shaping::measure_text;pub use shaping::measure_text_with_attrs;pub use shaping::shape_text;pub use shaping::ShapedGlyph;pub use shaping::ShapedLine;pub use shaping::Shaper;pub use shaping::TextMetrics;
Modules§
- cache
- Two-tier text cache:
TextShapeCache,ShapeCacheKey. Two-tier text measurement and glyph shaping cache. - font
- Font system abstraction:
FontManager,FontId,FontSource. Font system abstraction: system font discovery viafontdb, custom font asset loading, and font identity types. - ime
- Velocity-damped kinetic IME candidate positioning. Velocity-damped kinetic IME candidate positioning.
- shaping
- Complex text shaping:
Shaper,TextMetrics,ShapedLine. Complex text shaping: BiDi, line breaking, font fallback chaining, and text measurement via cosmic-text.
Structs§
- Attrs
- Text attributes
- Buffer
- A buffer of text that is shaped and laid out
- Font
System - Access to the system fonts.
- Metrics
- Metrics of text
Enums§
- Family
- A font family.
- Shaping
- The shaping strategy of some text.