Files
ladybird/Libraries/LibWebView/Plugins/FontPlugin.h
Tim Ledbetter 3e704e0fd6 LibGfx+LibWeb: Fall back to system fonts for missing glyphs
When rendering text, if none of the fonts in the cascade list contain a
glyph for a given code point, we now query Skia's font manager to find
a system font that can render it.
2026-01-21 14:01:35 +01:00

39 lines
1.1 KiB
C++

/*
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibWeb/Platform/FontPlugin.h>
#include <LibWebView/Forward.h>
namespace WebView {
class WEBVIEW_API FontPlugin final : public Web::Platform::FontPlugin {
public:
FontPlugin(bool is_layout_test_mode, Gfx::SystemFontProvider* = nullptr);
virtual ~FontPlugin();
virtual RefPtr<Gfx::Font> default_font(float point_size) override;
virtual Gfx::Font& default_fixed_width_font() override;
virtual FlyString generic_font_name(Web::Platform::GenericFont) override;
virtual Vector<FlyString> symbol_font_names() override;
virtual bool is_layout_test_mode() const override { return m_is_layout_test_mode; }
void update_generic_fonts();
private:
Vector<FlyString> m_generic_font_names;
Vector<FlyString> m_symbol_font_names;
FlyString m_default_font_name;
RefPtr<Gfx::Font> m_default_fixed_width_font;
bool m_is_layout_test_mode { false };
};
}