1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 19:55:07 +00:00
serenity/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

54 lines
1.4 KiB
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "FontPluginSerenity.h"
#include <AK/DeprecatedString.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();
}
DeprecatedString 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();
}
}