Skip to main content

RenderString

Trait RenderString 

Source
pub trait RenderString: HasFont {
    // Required method
    fn text(self: Pin<&Self>) -> PlainOrStyledText;

    // Provided methods
    fn max_lines(self: Pin<&Self>) -> i32 { ... }
    fn line_limit(self: Pin<&Self>) -> Option<usize> { ... }
    fn stroke(self: Pin<&Self>) -> (Brush, LogicalLength, TextStrokeStyle) { ... }
    fn link_color(self: Pin<&Self>) -> Color { ... }
}
Expand description

Trait for an item that represents an string towards the renderer

Required Methods§

Source

fn text(self: Pin<&Self>) -> PlainOrStyledText

Provided Methods§

Source

fn max_lines(self: Pin<&Self>) -> i32

Source

fn line_limit(self: Pin<&Self>) -> Option<usize>

The maximum number of lines to lay out and render, from the max-lines property. Property values less than or equal to zero mean no limit.

Source

fn stroke(self: Pin<&Self>) -> (Brush, LogicalLength, TextStrokeStyle)

Stroke brush, width and style. The style is baked into the shaped glyphs, so it lives here (rather than in RenderText) to keep measuring and drawing shaping-identical.

Color of Style::Link spans. Like stroke, it’s baked into the shaped glyphs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RenderString for (SharedString, Brush)

Source§

fn text(self: Pin<&Self>) -> PlainOrStyledText

Implementors§