diff options
author | MacDue <macdue@dueutil.tech> | 2023-04-01 21:12:15 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-01 22:39:47 +0100 |
commit | 7061a3d8e6ef3f32b9da5e6b65a331f6ff2e54a3 (patch) | |
tree | 22c5bc107edd8f828f205a51d5c8f0d4a1c978c8 /Userland/Libraries/LibWeb/Painting | |
parent | f3c450559fce1e8af9df0c7a160c34239cd4319d (diff) | |
download | serenity-7061a3d8e6ef3f32b9da5e6b65a331f6ff2e54a3.zip |
LibWeb: Add .scaled_font() helper to Layout::Node
This returns the font scaled for the current zoom level.
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 4dcbf262df..2dc955f41b 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -8,7 +8,6 @@ #include <AK/GenericShorthands.h> #include <LibUnicode/CharacterTypes.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/FontCache.h> #include <LibWeb/HTML/HTMLHtmlElement.h> #include <LibWeb/Layout/BlockContainer.h> #include <LibWeb/Layout/Viewport.h> @@ -525,16 +524,16 @@ static void paint_text_fragment(PaintContext& context, Layout::TextNode const& t DevicePixelPoint baseline_start { fragment_absolute_device_rect.x(), fragment_absolute_device_rect.y() + context.rounded_device_pixels(fragment.baseline()) }; Utf8View view { text.substring_view(fragment.start(), fragment.length()) }; - auto scaled_font = FontCache::the().scaled_font(fragment.layout_node().font(), context.device_pixels_per_css_pixel()); + auto& scaled_font = fragment.layout_node().scaled_font(context); - painter.draw_text_run(baseline_start.to_type<int>(), view, *scaled_font, text_node.computed_values().color()); + painter.draw_text_run(baseline_start.to_type<int>(), view, scaled_font, text_node.computed_values().color()); auto selection_rect = context.enclosing_device_rect(fragment.selection_rect(text_node.font())).to_type<int>(); if (!selection_rect.is_empty()) { painter.fill_rect(selection_rect, context.palette().selection()); Gfx::PainterStateSaver saver(painter); painter.add_clip_rect(selection_rect); - painter.draw_text_run(baseline_start.to_type<int>(), view, *scaled_font, context.palette().selection_text()); + painter.draw_text_run(baseline_start.to_type<int>(), view, scaled_font, context.palette().selection_text()); } paint_text_decoration(context, painter, text_node, fragment); |