mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
[style] Tweak vertical text alignment
This commit is contained in:
@@ -722,7 +722,7 @@ impl TitleBar {
|
||||
|
||||
let full_top_rect = Rect::from_x_y_ranges(self.rect.x_range(), self.min_rect.y_range());
|
||||
let text_pos = math::align::center_size_in_rect(self.title_galley.size, full_top_rect);
|
||||
let text_pos = text_pos.left_top() - 2.0 * Vec2::Y; // HACK: center on x-height of text (looks better)
|
||||
let text_pos = text_pos.left_top() - 1.5 * Vec2::Y; // HACK: center on x-height of text (looks better)
|
||||
self.title_label
|
||||
.paint_galley(ui, text_pos, self.title_galley);
|
||||
|
||||
|
||||
@@ -322,13 +322,14 @@ impl FontImplCache {
|
||||
}
|
||||
|
||||
let y_offset = if font_name == "emoji-icon-font" {
|
||||
1.0 // TODO: remove font alignment hack
|
||||
scale_in_points * 0.235 // TODO: remove font alignment hack
|
||||
} else {
|
||||
-3.0 // TODO: remove font alignment hack
|
||||
0.0
|
||||
};
|
||||
let y_offset = y_offset - 3.0; // Tweaked to make text look centered in buttons and text edit fields
|
||||
|
||||
let scale_in_points = if font_name == "emoji-icon-font" {
|
||||
scale_in_points - 2.0 // TODO: remove HACK!
|
||||
scale_in_points * 0.8 // TODO: remove HACK!
|
||||
} else {
|
||||
scale_in_points
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user