blob: 4d588f47d3486d10691735819c5fa578ccdf3966 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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();
}
}
|