Function first_layout_baseline

Source
pub fn first_layout_baseline(layout: &PreparedTextLayout) -> f32
Expand description

Returns the first shaped line’s baseline in layout-local logical pixels.

Empty layouts use the zero sentinel.

§Examples

use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_editor::layout::first_layout_baseline;
use ailloli_ui_text::{TextLayoutParams, TextSystem};
let mut system = TextSystem::new();
let layout = system.layout_cached(TextLayoutParams::new(
    "x", TextStyle::new(FontId::Mono, 13, Color::WHITE),
));
assert!(first_layout_baseline(&layout) >= 0.0);