Change default text centering to BOTTOM

This commit is contained in:
Emil Ernerfeldt
2024-09-19 09:46:05 +02:00
parent 098032eb05
commit 44714285b0
3 changed files with 8 additions and 4 deletions
+1 -2
View File
@@ -621,8 +621,7 @@ impl Ui {
#[inline]
pub fn text_valign(&self) -> Align {
#![allow(clippy::unused_self)]
// We currently always center-align, because that makes emojis and text nice and centered everywhere.
Align::Center
Align::BOTTOM
}
/// Create a painter for a sub-region of this Ui.
+6 -1
View File
@@ -604,7 +604,12 @@ fn galley_from_rows(
glyph.pos.y = cursor_y
+ glyph.font_impl_ascent
+ format.valign.to_factor() * (row_height - glyph.font_impl_height);
+ format.valign.to_factor() * (row_height - glyph.font_impl_height)
// When mixing different `FontImpl` (e.g. latin and emojis),
// we always center the difference:
+ 0.5 * (glyph.font_impl_height - glyph.size.y);
glyph.pos.y = point_scale.round_to_pixel(glyph.pos.y);
}
+1 -1
View File
@@ -301,7 +301,7 @@ impl Default for TextFormat {
italics: false,
underline: Stroke::NONE,
strikethrough: Stroke::NONE,
valign: Align::Center,
valign: Align::BOTTOM,
}
}
}