2022-09-08 12:44:17 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-09-08 12:44:17 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-17 21:25:15 +02:00
|
|
|
#include <AK/RefPtr.h>
|
2022-09-08 12:44:17 +02:00
|
|
|
#include <AK/Vector.h>
|
2024-10-11 18:17:07 -06:00
|
|
|
#include <LibGfx/Font/FontDatabase.h>
|
2022-09-08 12:44:17 +02:00
|
|
|
#include <LibWeb/Platform/FontPlugin.h>
|
2025-07-01 20:55:11 -07:00
|
|
|
#include <LibWebView/Forward.h>
|
2022-09-08 12:44:17 +02:00
|
|
|
|
2024-11-10 09:53:15 -05:00
|
|
|
namespace WebView {
|
2022-09-08 12:44:17 +02:00
|
|
|
|
2025-07-01 20:55:11 -07:00
|
|
|
class WEBVIEW_API FontPlugin final : public Web::Platform::FontPlugin {
|
2022-09-08 12:44:17 +02:00
|
|
|
public:
|
2024-10-11 18:17:07 -06:00
|
|
|
FontPlugin(bool is_layout_test_mode, Gfx::SystemFontProvider* = nullptr);
|
2023-08-02 12:01:17 -06:00
|
|
|
virtual ~FontPlugin();
|
2022-09-08 12:44:17 +02:00
|
|
|
|
2025-01-02 03:56:05 +03:00
|
|
|
virtual RefPtr<Gfx::Font> default_font(float point_size) override;
|
2022-09-17 21:25:15 +02:00
|
|
|
virtual Gfx::Font& default_fixed_width_font() override;
|
2024-09-05 22:35:01 +02:00
|
|
|
virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) override;
|
2023-09-06 07:45:47 +02:00
|
|
|
virtual FlyString generic_font_name(Web::Platform::GenericFont) override;
|
2022-09-08 12:44:17 +02:00
|
|
|
|
|
|
|
void update_generic_fonts();
|
|
|
|
|
|
|
|
private:
|
2023-09-06 07:45:47 +02:00
|
|
|
Vector<FlyString> m_generic_font_names;
|
2025-01-02 03:56:05 +03:00
|
|
|
FlyString m_default_font_name;
|
2022-09-17 21:25:15 +02:00
|
|
|
RefPtr<Gfx::Font> m_default_fixed_width_font;
|
2023-05-06 12:46:14 +02:00
|
|
|
bool m_is_layout_test_mode { false };
|
2022-09-08 12:44:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|