[style] Tweak vertical text alignment

This commit is contained in:
Emil Ernerfeldt 2021-01-12 21:01:03 +01:00
parent 6d8a766614
commit b10dcf5012
2 changed files with 5 additions and 4 deletions

View file

@ -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);

View file

@ -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
};