summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-20 18:55:23 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-20 20:55:29 +0200
commit8a6c37deef4913d44aae61385d702f92a01c314b (patch)
tree41ec009b25c8a83f051c994acccaa6e98ea4dd1f /Userland
parent6a012ad79f95673a36531c27c81e0efa6c6ec664 (diff)
downloadserenity-8a6c37deef4913d44aae61385d702f92a01c314b.zip
LibGfx: Remove Gfx::FontDatabase::default_bold_fixed_width_font()
Ask for a bold_variant() of the default_fixed_width_font() instead.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Demos/LibGfxDemo/main.cpp2
-rw-r--r--Userland/Games/Snake/SnakeGame.cpp2
-rw-r--r--Userland/Libraries/LibGfx/FontDatabase.cpp10
-rw-r--r--Userland/Libraries/LibGfx/FontDatabase.h2
-rw-r--r--Userland/Libraries/LibVT/TerminalWidget.cpp3
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp2
6 files changed, 4 insertions, 17 deletions
diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp
index a0421adece..a293bd7dff 100644
--- a/Userland/Demos/LibGfxDemo/main.cpp
+++ b/Userland/Demos/LibGfxDemo/main.cpp
@@ -149,7 +149,7 @@ void Canvas::draw()
painter.draw_text({ 520, 415, 240, 20 }, "Normal text", Gfx::FontDatabase::default_font(), Gfx::TextAlignment::CenterLeft, Color::Red);
painter.draw_text({ 520, 430, 240, 20 }, "Bold text", Gfx::FontDatabase::default_font().bold_variant(), Gfx::TextAlignment::CenterLeft, Color::Green);
painter.draw_text({ 520, 450, 240, 20 }, "Normal text (fixed width)", Gfx::FontDatabase::default_fixed_width_font(), Gfx::TextAlignment::CenterLeft, Color::Blue);
- painter.draw_text({ 520, 465, 240, 20 }, "Bold text (fixed width)", Gfx::FontDatabase::default_bold_fixed_width_font(), Gfx::TextAlignment::CenterLeft, Color::Yellow);
+ painter.draw_text({ 520, 465, 240, 20 }, "Bold text (fixed width)", Gfx::FontDatabase::default_fixed_width_font().bold_variant(), Gfx::TextAlignment::CenterLeft, Color::Yellow);
auto font = Gfx::BitmapFont::load_from_file("/res/fonts/PebbletonBold14.font");
painter.draw_rect({ 520, 510, 240, 30 }, Color::DarkGray);
diff --git a/Userland/Games/Snake/SnakeGame.cpp b/Userland/Games/Snake/SnakeGame.cpp
index c8d8e423fb..5a63aa5e37 100644
--- a/Userland/Games/Snake/SnakeGame.cpp
+++ b/Userland/Games/Snake/SnakeGame.cpp
@@ -15,7 +15,7 @@
SnakeGame::SnakeGame()
{
- set_font(Gfx::FontDatabase::default_bold_fixed_width_font());
+ set_font(Gfx::FontDatabase::default_fixed_width_font().bold_variant());
m_fruit_bitmaps.append(*Gfx::Bitmap::load_from_file("/res/icons/snake/paprika.png"));
m_fruit_bitmaps.append(*Gfx::Bitmap::load_from_file("/res/icons/snake/eggplant.png"));
m_fruit_bitmaps.append(*Gfx::Bitmap::load_from_file("/res/icons/snake/cauliflower.png"));
diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp
index b71bc61c01..d059de5f94 100644
--- a/Userland/Libraries/LibGfx/FontDatabase.cpp
+++ b/Userland/Libraries/LibGfx/FontDatabase.cpp
@@ -44,16 +44,6 @@ Font& FontDatabase::default_fixed_width_font()
return *font;
}
-Font& FontDatabase::default_bold_fixed_width_font()
-{
- static Font* font;
- if (!font) {
- font = FontDatabase::the().get_by_name("Csilla 10 700");
- VERIFY(font);
- }
- return *font;
-}
-
struct FontDatabase::Private {
HashMap<String, RefPtr<Gfx::Font>> full_name_to_font_map;
Vector<RefPtr<Typeface>> typefaces;
diff --git a/Userland/Libraries/LibGfx/FontDatabase.h b/Userland/Libraries/LibGfx/FontDatabase.h
index 64b029dd90..7ad5f8b691 100644
--- a/Userland/Libraries/LibGfx/FontDatabase.h
+++ b/Userland/Libraries/LibGfx/FontDatabase.h
@@ -35,9 +35,7 @@ public:
static FontDatabase& the();
static Font& default_font();
-
static Font& default_fixed_width_font();
- static Font& default_bold_fixed_width_font();
RefPtr<Gfx::Font> get(const String& family, unsigned size, unsigned weight);
RefPtr<Gfx::Font> get(const String& family, const String& variant, unsigned size);
diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp
index db287562eb..e9bf2ca410 100644
--- a/Userland/Libraries/LibVT/TerminalWidget.cpp
+++ b/Userland/Libraries/LibVT/TerminalWidget.cpp
@@ -1063,8 +1063,7 @@ void TerminalWidget::did_change_font()
GUI::Frame::did_change_font();
m_line_height = font().glyph_height() + m_line_spacing;
- // TODO: try to find a bold version of the new font (e.g. CsillaThin7x10 -> CsillaBold7x10)
- const Gfx::Font& bold_font = Gfx::FontDatabase::default_bold_fixed_width_font();
+ const Gfx::Font& bold_font = font().bold_variant();
if (bold_font.glyph_height() == font().glyph_height() && bold_font.glyph_width(' ') == font().glyph_width(' '))
m_bold_font = &bold_font;
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 5fa06a9b31..f08ec06fa9 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -194,7 +194,7 @@ void StyleProperties::load_font() const
RefPtr<Gfx::Font> StyleProperties::font_fallback(bool monospace, bool bold) const
{
if (monospace && bold)
- return Gfx::FontDatabase::default_bold_fixed_width_font();
+ return Gfx::FontDatabase::default_fixed_width_font().bold_variant();
if (monospace)
return Gfx::FontDatabase::default_fixed_width_font();