Skip to main content

draw_rich_text

Function draw_rich_text 

Source
pub fn draw_rich_text<'a, I>(
    position: Vector2,
    size: f32,
    font: Option<&Font>,
    color: Color,
    spans: I,
)
where I: IntoIterator, I::Item: Borrow<Span<'a>>,
Expand description

Draws a collection of Spans in sequence where each Span can have different properties such as

  • text
  • color
  • size
  • font The spans should implement IntoIterator. Which means you can just pass an iterator.

ยงExamples

draw_rich_text(vec2(10.0, 10.0), &[
    span("Hello there\n", WHITE),
    span("My name is ", WHITE),
    span("John Doe", RED)
        .with_color(RED)
        .with_size(32.0)
]);