1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

Revert "LibGfx: Remove bogus baseline adjustment in Painter's draw_text_line()"

This reverts commit 2b2915656d.

While this adjustment is bogus, it is currently responsible for putting
CenterLeft aligned scalable text in the right position.

This is going to take a bunch of work to get right.
This commit is contained in:
Andreas Kling 2022-03-27 03:01:09 +02:00
parent 2b2915656d
commit 5c5e4b5ae5

View file

@ -1365,6 +1365,11 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
if (is_vertically_centered_text_alignment(alignment)) {
int distance_from_baseline_to_bottom = (font.pixel_size() - 1) - font.baseline();
rect.translate_by(0, distance_from_baseline_to_bottom / 2);
}
auto point = rect.location(); auto point = rect.location();
int space_width = font.glyph_width(' ') + font.glyph_spacing(); int space_width = font.glyph_width(' ') + font.glyph_spacing();