mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:18:12 +00:00
LibWeb+WebContent: Add abstraction layer for generic font families
Instead of hard-coding the names of system fonts to use for the CSS generic fonts (like "sans-serif", "monospace", etc.) we now call out to a Platform::FontPlugin and ask for the generic names.
This commit is contained in:
parent
26544f559c
commit
5c2e3d1637
8 changed files with 153 additions and 8 deletions
27
Userland/Libraries/LibWeb/Platform/FontPlugin.cpp
Normal file
27
Userland/Libraries/LibWeb/Platform/FontPlugin.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Platform/FontPlugin.h>
|
||||
|
||||
namespace Web::Platform {
|
||||
|
||||
static FontPlugin* s_the;
|
||||
|
||||
FontPlugin& FontPlugin::the()
|
||||
{
|
||||
VERIFY(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
void FontPlugin::install(FontPlugin& plugin)
|
||||
{
|
||||
VERIFY(!s_the);
|
||||
s_the = &plugin;
|
||||
}
|
||||
|
||||
FontPlugin::~FontPlugin() = default;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue