mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:47:35 +00:00
LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase (where it's all hardcoded), they now get it from WindowServer. These are then plumbed into the usual Gfx::FontDatabase places so that the old default_font() and default_fixed_width_font() APIs keep working.
This commit is contained in:
parent
66ad739934
commit
bb23e61fbf
11 changed files with 76 additions and 15 deletions
|
@ -24,24 +24,55 @@ FontDatabase& FontDatabase::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
static RefPtr<Font> s_default_font;
|
||||
static String s_default_font_query;
|
||||
static RefPtr<Font> s_fixed_width_font;
|
||||
static String s_fixed_width_font_query;
|
||||
|
||||
void FontDatabase::set_default_font_query(String query)
|
||||
{
|
||||
if (s_default_font_query == query)
|
||||
return;
|
||||
s_default_font_query = move(query);
|
||||
s_default_font = nullptr;
|
||||
}
|
||||
|
||||
String FontDatabase::default_font_query()
|
||||
{
|
||||
return s_default_font_query;
|
||||
}
|
||||
|
||||
Font& FontDatabase::default_font()
|
||||
{
|
||||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Katica 10 400");
|
||||
VERIFY(font);
|
||||
if (!s_default_font) {
|
||||
VERIFY(!s_default_font_query.is_empty());
|
||||
s_default_font = FontDatabase::the().get_by_name(s_default_font_query);
|
||||
VERIFY(s_default_font);
|
||||
}
|
||||
return *font;
|
||||
return *s_default_font;
|
||||
}
|
||||
|
||||
void FontDatabase::set_fixed_width_font_query(String query)
|
||||
{
|
||||
if (s_fixed_width_font_query == query)
|
||||
return;
|
||||
s_fixed_width_font_query = move(query);
|
||||
s_fixed_width_font = nullptr;
|
||||
}
|
||||
|
||||
String FontDatabase::fixed_width_font_query()
|
||||
{
|
||||
return s_fixed_width_font_query;
|
||||
}
|
||||
|
||||
Font& FontDatabase::default_fixed_width_font()
|
||||
{
|
||||
static Font* font;
|
||||
if (!font) {
|
||||
font = FontDatabase::the().get_by_name("Csilla 10 400");
|
||||
VERIFY(font);
|
||||
if (!s_fixed_width_font) {
|
||||
VERIFY(!s_fixed_width_font_query.is_empty());
|
||||
s_fixed_width_font = FontDatabase::the().get_by_name(s_fixed_width_font_query);
|
||||
VERIFY(s_fixed_width_font);
|
||||
}
|
||||
return *font;
|
||||
return *s_fixed_width_font;
|
||||
}
|
||||
|
||||
struct FontDatabase::Private {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue