1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Refactor font layout: introduce y_max for each Line in a Galley

This commit is contained in:
Emil Ernerfeldt
2020-05-16 20:05:52 +02:00
parent c0e7f947ff
commit ce0e7f4e09
3 changed files with 125 additions and 116 deletions

View File

@@ -143,7 +143,6 @@ impl Widget for Hyperlink {
let text_style = TextStyle::Body;
let id = ui.make_child_id(&self.url);
let font = &ui.fonts()[text_style];
let line_spacing = font.line_spacing();
let galley = font.layout_multiline(&self.text, ui.available().width());
let interact = ui.reserve_space(galley.size, Some(id));
if interact.hovered {
@@ -157,7 +156,7 @@ impl Widget for Hyperlink {
// Underline:
for line in &galley.lines {
let pos = interact.rect.min;
let y = pos.y + line.y_offset + line_spacing;
let y = pos.y + line.y_max;
let y = ui.round_to_pixel(y);
let min_x = pos.x + line.min_x();
let max_x = pos.x + line.max_x();