Function layout_visual_height

Source
pub fn layout_visual_height(
    layout: &PreparedTextLayout,
    style: EditorStyle,
) -> f32
Expand description

Returns the run height in logical pixels with an editor-line-height floor.

The configured floor is itself clamped to at least 1.0; non-finite layout or style values are not repaired beyond normal f32::max behavior.

ยงExamples

use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_editor::{layout::layout_visual_height, EditorStyle};
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!(layout_visual_height(&layout, EditorStyle::default()) >= 18.0);