Skip to main content

wrap_text_with_fallback

Function wrap_text_with_fallback 

Source
pub fn wrap_text_with_fallback(
    text: &str,
    font: &Font,
    emoji_font: &Option<Font>,
    max_width: Option<f32>,
) -> Vec<String>
Expand description

Wrap text respecting emoji font fallback for accurate measurement.

Known gap (issue #125): the fit test below always measures at zero letter-spacing, regardless of what the caller will actually paint with. Kept at its original signature/behaviour for source compatibility with existing call sites (rustmotion-components/src/intrinsic.rs, text.rs, shape.rs, gradient_text.rs — outside this workstream’s file scope) that measure and paint with real letter-spacing but still wrap through this function. New call sites, and any existing call site whose text can carry non-zero letter-spacing, should call wrap_text_with_tracking instead — it is a straight drop-in (same signature plus one trailing letter_spacing: f32 argument) that fixes the measure/paint disagreement described there.