mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Change default text centering to BOTTOM
This commit is contained in:
@@ -621,8 +621,7 @@ impl Ui {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn text_valign(&self) -> Align {
|
pub fn text_valign(&self) -> Align {
|
||||||
#![allow(clippy::unused_self)]
|
#![allow(clippy::unused_self)]
|
||||||
// We currently always center-align, because that makes emojis and text nice and centered everywhere.
|
Align::BOTTOM
|
||||||
Align::Center
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a painter for a sub-region of this Ui.
|
/// Create a painter for a sub-region of this Ui.
|
||||||
|
|||||||
@@ -604,7 +604,12 @@ fn galley_from_rows(
|
|||||||
|
|
||||||
glyph.pos.y = cursor_y
|
glyph.pos.y = cursor_y
|
||||||
+ glyph.font_impl_ascent
|
+ 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);
|
glyph.pos.y = point_scale.round_to_pixel(glyph.pos.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ impl Default for TextFormat {
|
|||||||
italics: false,
|
italics: false,
|
||||||
underline: Stroke::NONE,
|
underline: Stroke::NONE,
|
||||||
strikethrough: Stroke::NONE,
|
strikethrough: Stroke::NONE,
|
||||||
valign: Align::Center,
|
valign: Align::BOTTOM,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user