mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 15:13:12 -04:00
Change default text centering to BOTTOM
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ impl Default for TextFormat {
|
||||
italics: false,
|
||||
underline: Stroke::NONE,
|
||||
strikethrough: Stroke::NONE,
|
||||
valign: Align::Center,
|
||||
valign: Align::BOTTOM,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user