Expand description
Core traits and shared types for Typf.
This crate defines the common contract used by the rest of the Typf workspace: pipeline stages, shaping and rendering traits, shared error types, caches, and the data structures that move from one stage to the next.
Typf models text rendering as six conceptual steps:
- read input text,
- analyse script and direction,
- choose a font,
- shape characters into positioned glyphs,
- render those glyphs into pixels or vector data,
- export the result.
The default pipeline currently exposes the shaping, rendering, and export steps directly. The earlier stages still matter because other crates may use them for bidi resolution, text segmentation, or font fallback.
To extend Typf, implement one or more of these traits:
Stagefor a general pipeline step,Shaperfor text shaping,Rendererfor glyph rendering,Exporterfor serialization,traits::FontReffor access to font data.
Shared values passed between those steps live in types.
Re-exports§
pub use context::PipelineContext;pub use error::Result;pub use error::TypfError;pub use pipeline::Pipeline;pub use pipeline::PipelineBuilder;pub use traits::Exporter;pub use traits::Renderer;pub use traits::Shaper;pub use traits::Stage;
Modules§
- cache
- Scan-resistant caching with TinyLFU and byte-weighted eviction
- cache_
config - Global cache configuration
- context
- The traveling container that carries data through pipeline stages
- error
- When things go wrong in the pipeline
- ffi
- C-ABI compatible types for FFI consumers.
- glyph_
cache - Backend-neutral glyph/render cache with byte-weighted eviction
- linra
- Linra rendering: shape and render in a single pass
- pipeline
- Pipeline orchestration for shaping, rendering, and export.
- shaping_
cache - Backend-agnostic shaping cache
- traits
- The contracts that bind every backend together
- types
- The data structures that move through the pipeline.
Structs§
- Color
- Glyph
Source Preference - Preference ordering and deny list for glyph sources
- Render
Params - Shaping
Params
Enums§
Constants§
- DEFAULT_
MAX_ BITMAP_ HEIGHT - Default maximum bitmap height: 16k pixels
- DEFAULT_
MAX_ BITMAP_ PIXELS - Default maximum total bitmap pixels: 1 Gpix
- DEFAULT_
MAX_ BITMAP_ WIDTH - Default maximum bitmap dimension (width): 16,777,216 pixels (16M)
- MAX_
FONT_ SIZE - Maximum font size in pixels to prevent DoS attacks.
- MAX_
GLYPH_ COUNT - Maximum number of glyphs to render in a single operation.
Functions§
- get_
max_ bitmap_ height - get_
max_ bitmap_ pixels - get_
max_ bitmap_ width - validate_
glyph_ count - Validate glyph count against security limits