1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Fix valign/centering

This commit is contained in:
Emil Ernerfeldt
2024-09-19 10:10:27 +02:00
parent 3c705c010e
commit 7d51ab12d7

View File

@@ -605,11 +605,12 @@ fn galley_from_rows(
glyph.pos.y = cursor_y
+ glyph.font_impl_ascent
+ format.valign.to_factor() * (row_height - glyph.font_impl_height)
// Apply valign to the different in height of the entire row, and the height of this `Font`:
+ format.valign.to_factor() * (row_height - glyph.size.y)
// When mixing different `FontImpl` (e.g. latin and emojis),
// we always center the difference:
+ 0.5 * (glyph.font_impl_height - glyph.size.y);
+ 0.5 * (glyph.size.y - glyph.font_impl_height);
glyph.pos.y = point_scale.round_to_pixel(glyph.pos.y);
}