Function draw_rich_text

Source
pub fn draw_rich_text(
    baseline_xy: [f32; 2],
    rich: &RichText,
    text_system: &mut TextSystem,
) -> Option<DrawCmd>
Expand description

Concatenates spans into one string using the first span’s style.

Full Parley multi-style layout in a single run is not implemented yet. Returns None for an empty span list. baseline_xy is in logical pixels and its y coordinate is the text baseline. The merged string allocates once.

§Examples

use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_text::TextSystem;
use ailloli_ui_widgets::text::{draw_rich_text, RichText};
let mut text_system = TextSystem::new();
let rich = RichText::plain("hello", TextStyle::new(FontId::Ui, 14, Color::WHITE));
assert!(draw_rich_text([2.0, 18.0], &rich, &mut text_system).is_some());