pub fn run_visual_top(run: &EditorTextRun) -> f32Expand description
Returns a run’s top edge relative to the text viewport.
§Examples
use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_editor::layout::{first_layout_baseline, run_visual_top, EditorTextRun};
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),
));
let baseline = first_layout_baseline(&layout);
let run = EditorTextRun { index: 0, byte_range: 0..1, baseline_y: baseline + 7.0, layout };
assert_eq!(run_visual_top(&run), 7.0);