1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Use the largest ascent as the ascent for a font

This commit is contained in:
Emil Ernerfeldt
2024-09-18 13:55:26 +02:00
parent a32f53a105
commit 46e44b3af5
2 changed files with 16 additions and 4 deletions

View File

@@ -172,7 +172,7 @@ fn layout_section(
chr,
pos: pos2(paragraph.cursor_x, f32::NAN),
size: vec2(glyph_info.advance_width, line_height),
ascent: font_impl.map_or(0.0, |font| font.ascent()), // Failure to find the font here would be weird
ascent: font.ascent(),
uv_rect: glyph_info.uv_rect,
section_index,
});
@@ -392,7 +392,7 @@ fn replace_last_glyph_with_overflow_character(
chr: overflow_character,
pos: pos2(x, f32::NAN),
size: vec2(replacement_glyph_info.advance_width, line_height),
ascent: font_impl.map_or(0.0, |font| font.ascent()), // Failure to find the font here would be weird
ascent: font.ascent(),
uv_rect: replacement_glyph_info.uv_rect,
section_index,
});
@@ -404,13 +404,13 @@ fn replace_last_glyph_with_overflow_character(
let x = 0.0; // TODO(emilk): heed paragraph leading_space 😬
let (font_impl, replacement_glyph_info) = font.font_impl_and_glyph_info(overflow_character);
let (_, replacement_glyph_info) = font.font_impl_and_glyph_info(overflow_character);
row.glyphs.push(Glyph {
chr: overflow_character,
pos: pos2(x, f32::NAN),
size: vec2(replacement_glyph_info.advance_width, line_height),
ascent: font_impl.map_or(0.0, |font| font.ascent()), // Failure to find the font here would be weird
ascent: font.ascent(),
uv_rect: replacement_glyph_info.uv_rect,
section_index,
});