pub struct ShapingFallback<S: TextShaper = NoopShaper> { /* private fields */ }Expand description
Transparent shaping with guaranteed fallback.
Wraps an optional primary shaper and a NoopShaper fallback. Always
produces a valid ShapedLineLayout regardless of whether the primary
shaper is available or succeeds.
The output layout has identical API surface for both paths, so downstream code (cursor, selection, copy, rendering) does not need to branch on which shaping path was used.
Implementations§
Source§impl<S: TextShaper> ShapingFallback<S>
impl<S: TextShaper> ShapingFallback<S>
Sourcepub fn with_shaper(shaper: S, capabilities: RuntimeCapability) -> Self
pub fn with_shaper(shaper: S, capabilities: RuntimeCapability) -> Self
Create a fallback with a primary shaper.
Sourcepub fn set_features(&mut self, features: FontFeatures)
pub fn set_features(&mut self, features: FontFeatures)
Set the font features used for shaping.
Sourcepub fn set_shaping_tier(&mut self, tier: LayoutTier)
pub fn set_shaping_tier(&mut self, tier: LayoutTier)
Set the minimum tier for shaping.
Sourcepub fn set_capabilities(&mut self, caps: RuntimeCapability)
pub fn set_capabilities(&mut self, caps: RuntimeCapability)
Update runtime capabilities (e.g., after font load/unload).
Sourcepub fn set_validate_output(&mut self, validate: bool)
pub fn set_validate_output(&mut self, validate: bool)
Enable or disable output validation.
Sourcepub fn shape_line(
&self,
text: &str,
script: Script,
direction: RunDirection,
) -> (ShapedLineLayout, FallbackEvent)
pub fn shape_line( &self, text: &str, script: Script, direction: RunDirection, ) -> (ShapedLineLayout, FallbackEvent)
Shape a line of text with automatic fallback.
Returns the layout and a diagnostic event describing which path was taken. The layout is guaranteed to be valid and non-empty for non-empty input.
Sourcepub fn shape_lines(
&self,
lines: &[&str],
script: Script,
direction: RunDirection,
) -> (Vec<ShapedLineLayout>, FallbackStats)
pub fn shape_lines( &self, lines: &[&str], script: Script, direction: RunDirection, ) -> (Vec<ShapedLineLayout>, FallbackStats)
Shape multiple lines with fallback, collecting stats.
Returns layouts and accumulated statistics.