mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibWeb+WebContent: Move Serenity EventLoop and Font plugins into LibWeb
These are exactly what's wanted by headless-browser too, so this saves us some duplication. LibWeb already links LibCore so it should not cause any issues for Ladybird.
This commit is contained in:
parent
69dd158f91
commit
6b2a916069
9 changed files with 30 additions and 30 deletions
54
Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp
Normal file
54
Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "FontPluginSerenity.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
|
||||
namespace Web::Platform {
|
||||
|
||||
FontPluginSerenity::FontPluginSerenity()
|
||||
{
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
String FontPluginSerenity::generic_font_name(GenericFont generic_font)
|
||||
{
|
||||
// FIXME: Replace hard-coded font names with a relevant call to FontDatabase.
|
||||
// Currently, we cannot request the default font's name, or request it at a specific size and weight.
|
||||
// So, hard-coded font names it is.
|
||||
switch (generic_font) {
|
||||
case GenericFont::SansSerif:
|
||||
case GenericFont::UiSansSerif:
|
||||
case GenericFont::Cursive:
|
||||
case GenericFont::UiRounded:
|
||||
return "Katica";
|
||||
case GenericFont::Monospace:
|
||||
case GenericFont::UiMonospace:
|
||||
return "Csilla";
|
||||
case GenericFont::Serif:
|
||||
case GenericFont::UiSerif:
|
||||
return "Roman";
|
||||
case GenericFont::Fantasy:
|
||||
return "Comic Book";
|
||||
case GenericFont::__Count:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue