LibWeb+Ladybird: Remove FontPluginSerenity (+ use Ladybird::FontPlugin)

This commit is contained in:
Andreas Kling 2024-06-04 15:18:48 +02:00
parent fac126bce9
commit 966d442152
Notes: sideshowbarker 2024-07-16 23:44:30 +09:00
6 changed files with 2 additions and 83 deletions

View File

@ -8,6 +8,7 @@ set(WEBWORKER_SOURCES
"${WEBWORKER_SOURCE_DIR}/ConnectionFromClient.cpp"
"${WEBWORKER_SOURCE_DIR}/DedicatedWorkerHost.cpp"
"${WEBWORKER_SOURCE_DIR}/PageHost.cpp"
../FontPlugin.cpp
../HelperProcess.cpp
../Utilities.cpp
)

View File

@ -20,7 +20,6 @@
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
#include <LibWeb/Platform/FontPluginSerenity.h>
#include <LibWeb/WebSockets/WebSocket.h>
#include <LibWebView/RequestServerAdapter.h>
#include <LibWebView/WebSocketClientAdapter.h>
@ -45,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
Core::EventLoop event_loop;
Web::Platform::FontPlugin::install(*new Web::Platform::FontPluginSerenity);
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(false));
TRY(initialize_lagom_networking(request_server_socket));

View File

@ -7,7 +7,6 @@ source_set("Platform") {
"EventLoopPlugin.cpp",
"EventLoopPluginSerenity.cpp",
"FontPlugin.cpp",
"FontPluginSerenity.cpp",
"ImageCodecPlugin.cpp",
"Timer.cpp",
"TimerSerenity.cpp",

View File

@ -579,7 +579,6 @@ set(SOURCES
Platform/EventLoopPlugin.cpp
Platform/EventLoopPluginSerenity.cpp
Platform/FontPlugin.cpp
Platform/FontPluginSerenity.cpp
Platform/ImageCodecPlugin.cpp
Platform/Timer.cpp
Platform/TimerSerenity.cpp

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "FontPluginSerenity.h"
#include <AK/ByteString.h>
#include <LibGfx/Font/FontDatabase.h>
namespace Web::Platform {
FontPluginSerenity::FontPluginSerenity()
{
// NOTE: These will eventually get replaced by system defaults.
Gfx::FontDatabase::set_default_font_query("Katica 10 400 0");
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400 0");
}
FontPluginSerenity::~FontPluginSerenity() = default;
Gfx::Font& FontPluginSerenity::default_font()
{
return Gfx::FontDatabase::default_font();
}
Gfx::Font& FontPluginSerenity::default_fixed_width_font()
{
return Gfx::FontDatabase::default_fixed_width_font();
}
FlyString FontPluginSerenity::generic_font_name(GenericFont generic_font)
{
// FIXME: Make these configurable at the browser settings level. Fall back to system defaults.
switch (generic_font) {
case GenericFont::SansSerif:
case GenericFont::UiSansSerif:
case GenericFont::Cursive:
case GenericFont::UiRounded:
return default_font().family();
case GenericFont::Monospace:
case GenericFont::UiMonospace:
return default_fixed_width_font().family();
case GenericFont::Serif:
case GenericFont::UiSerif:
return "Roman"_fly_string;
case GenericFont::Fantasy:
return "Comic Book"_fly_string;
case GenericFont::__Count:
VERIFY_NOT_REACHED();
}
VERIFY_NOT_REACHED();
}
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibWeb/Platform/FontPlugin.h>
namespace Web::Platform {
class FontPluginSerenity final : public FontPlugin {
public:
FontPluginSerenity();
virtual ~FontPluginSerenity();
virtual Gfx::Font& default_font() override;
virtual Gfx::Font& default_fixed_width_font() override;
virtual FlyString generic_font_name(GenericFont) override;
};
}