FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TextFormatter

    trait · ferroui-base · v0.5.0

    trait TextFormatter: 'static
    

    Represents a base class for text formatting.

    View source

    Members

    format_line

    fn format_line(self: &Self, text_source: &dyn ITextSource, first_text_source_index: i32, paragraph_width: f64, paragraph_properties: &Rc<dyn TextParagraphProperties>, previous_line_break: Option<&Rc<TextLineBreak>>) -> Option<Rc<dyn TextLine>>
    

    Formats a text line.

    • text_source — the text source.
    • first_text_source_index — the first character index to start the text line from.
    • paragraph_width — a value that specifies the width of the paragraph that the line fills.
    • paragraph_properties — properties that control paragraph features such as text flow direction, text alignment, or indentation.
    • previous_line_break — the state of the previous line break.

    Source

    format_line_with_cache

    fn format_line_with_cache(self: &Self, text_source: &dyn ITextSource, first_text_source_index: i32, paragraph_width: f64, paragraph_properties: &Rc<dyn TextParagraphProperties>, previous_line_break: Option<&Rc<TextLineBreak>>, text_run_cache: Option<&TextRunCache>) -> Option<Rc<dyn TextLine>>
    

    Formats a text line, optionally using a TextRunCache to avoid redundant shaping.

    When a cache is provided, shaped runs from a previous call with the same first_text_source_index are reused, skipping shaping and bidi processing. This is useful when formatting the same text at different paragraph widths.

    • text_source — the text source.
    • first_text_source_index — the first character index to start the text line from.
    • paragraph_width — a value that specifies the width of the paragraph that the line fills.
    • paragraph_properties — properties that control paragraph features such as text flow direction, text alignment, or indentation.
    • previous_line_break — the state of the previous line break.
    • text_run_cache — an optional cache for shaped text runs.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.