Function draw_text_wrapped

Source
pub fn draw_text_wrapped(
    text: &str,
    x: f32,
    y: f32,
    max_width: f32,
    style: TextStyle,
) -> TextMetrics
Expand description

Draws text word-wrapped to max_width starting at baseline y; x anchors lines per the style’s alignment. Returns the wrapped block’s metrics.

use ferravex_render::{Color, text::{TextStyle, draw_text_wrapped}};
let body = TextStyle::modern(16., Color::from_hex(0xc8d3dc));
let m = draw_text_wrapped("Collect every gem before the lava rises.", 40., 200., 240., body);
assert!(m.width <= 240. && m.line_count >= 2);