2022-09-08 12:55:12 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "FontPluginSerenity.h"
|
2022-12-04 21:02:33 +03:00
|
|
|
#include <AK/DeprecatedString.h>
|
2022-09-08 12:55:12 +03:00
|
|
|
#include <LibGfx/Font/FontDatabase.h>
|
|
|
|
|
2022-09-21 21:33:57 +03:00
|
|
|
namespace Web::Platform {
|
2022-09-08 12:55:12 +03:00
|
|
|
|
|
|
|
FontPluginSerenity::FontPluginSerenity()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FontPluginSerenity::~FontPluginSerenity() = default;
|
|
|
|
|
2022-09-17 22:25:50 +03:00
|
|
|
Gfx::Font& FontPluginSerenity::default_font()
|
|
|
|
{
|
|
|
|
return Gfx::FontDatabase::default_font();
|
|
|
|
}
|
|
|
|
|
|
|
|
Gfx::Font& FontPluginSerenity::default_fixed_width_font()
|
|
|
|
{
|
|
|
|
return Gfx::FontDatabase::default_fixed_width_font();
|
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString FontPluginSerenity::generic_font_name(GenericFont generic_font)
|
2022-09-08 12:55:12 +03:00
|
|
|
{
|
|
|
|
// 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) {
|
2022-09-21 21:33:57 +03:00
|
|
|
case GenericFont::SansSerif:
|
|
|
|
case GenericFont::UiSansSerif:
|
|
|
|
case GenericFont::Cursive:
|
|
|
|
case GenericFont::UiRounded:
|
2022-09-08 12:55:12 +03:00
|
|
|
return "Katica";
|
2022-09-21 21:33:57 +03:00
|
|
|
case GenericFont::Monospace:
|
|
|
|
case GenericFont::UiMonospace:
|
2022-09-08 12:55:12 +03:00
|
|
|
return "Csilla";
|
2022-09-21 21:33:57 +03:00
|
|
|
case GenericFont::Serif:
|
|
|
|
case GenericFont::UiSerif:
|
2022-09-08 12:55:12 +03:00
|
|
|
return "Roman";
|
2022-09-21 21:33:57 +03:00
|
|
|
case GenericFont::Fantasy:
|
2022-09-08 12:55:12 +03:00
|
|
|
return "Comic Book";
|
2022-09-21 21:33:57 +03:00
|
|
|
case GenericFont::__Count:
|
2022-09-08 12:55:12 +03:00
|
|
|
VERIFY_NOT_REACHED();
|
|
|
|
}
|
|
|
|
VERIFY_NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|