mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibWeb: Scale the font when painting the text on buttons
Button text was staying the same size at all zoom levels. :^)
This commit is contained in:
parent
20132da88d
commit
5146b9b35e
4 changed files with 29 additions and 18 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibWeb/FontCache.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/Layout/ButtonBox.h>
|
||||
|
@ -47,7 +48,12 @@ void ButtonPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|||
auto offset = context.rounded_device_pixels(1);
|
||||
text_rect.translate_by(offset, offset);
|
||||
}
|
||||
context.painter().draw_text(text_rect.to_type<int>(), static_cast<HTML::HTMLInputElement const&>(dom_node).value(), layout_box().font(), Gfx::TextAlignment::Center, computed_values().color());
|
||||
context.painter().draw_text(
|
||||
text_rect.to_type<int>(),
|
||||
static_cast<HTML::HTMLInputElement const&>(dom_node).value(),
|
||||
FontCache::the().scaled_font(layout_box().font(), context.device_pixels_per_css_pixel()),
|
||||
Gfx::TextAlignment::Center,
|
||||
computed_values().color());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue