Function draw_text_styled

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

Draws styled text. y is the first line’s baseline (as with crate::draw_text_ex) and x anchors each line per TextStyle::align. Lines split on \n. Returns the same value as measure_text_styled.

Each layer emits one quad (6 vertices) per merged horizontal run per row; a shadow or outline adds one more layer. Nothing is drawn for an invalid style or non-finite position.

use ferravex_render::{Color, text::{TextStyle, draw_text_styled}};
let hud = TextStyle::modern(16., Color::from_hex(0xe4eef2)).with_shadow(Color::new(0., 0., 0., 0.55));
draw_text_styled("Score 12,480 ★", 24., 40., hud);