Incular logoIncular
API ReferenceText & Media

TextLayout

Measured text layout with caret mapping and layout options.

TextLayout is the measured result of shaping a TextSpan: lines, metrics, font runs, and caret positions.

use incular::prelude::*;

fn main() {
    let _options = TextLayoutOptions::new(Some(300.0), TextAlign::Start);
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(
                Text::new("Measured with options")
                    .max_lines(Some(3))
                    .overflow(TextOverflow::Ellipsis),
            )
            .build()
            .into()
    })
    .expect("valid application");
    incular::run(app).expect("run application");
}

Selection painting is line-by-line from cached Parley caret stops; both EditableText and SelectableRegion consume it.

Related: RichText, TextStyle.