1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:28:12 +00:00

LibWeb: Get default fonts via Platform::FontPlugin

Instead of asking Gfx::FontDatabase for the "default font" and the
"default fixed-width font", we now proxy those requests out via
the Platform::FontPlugin. This will allow Ladybird to use other default
fonts as fallback.
This commit is contained in:
Andreas Kling 2022-09-17 21:25:50 +02:00
parent 07a0d9df30
commit e72896e35e
10 changed files with 33 additions and 14 deletions

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Font/FontDatabase.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Painting/ImagePaintable.h>
#include <LibWeb/Platform/FontPlugin.h>
namespace Web::Layout {
@ -55,7 +55,7 @@ void ImageBox::prepare_for_replaced_layout()
if (renders_as_alt_text()) {
auto& image_element = verify_cast<HTML::HTMLImageElement>(dom_node());
auto& font = Gfx::FontDatabase::default_font();
auto& font = Platform::FontPlugin::the().default_font();
auto alt = image_element.alt();
if (alt.is_empty())
alt = image_element.src();