1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:38:10 +00:00

LibGfx+LibGUI+Clients: Make fonts findable by their qualified name

The qualified name of a font is "<Family> <Size> <Weight>". You can
get the QN of a Font via the Font::qualified_name() API, and you can
get any system font by QN from the GUI::FontDatabase. :^)
This commit is contained in:
Andreas Kling 2020-10-25 19:28:06 +01:00
parent 260b52215c
commit 9d347352a1
8 changed files with 57 additions and 61 deletions

View file

@ -39,6 +39,7 @@
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
#include <LibGUI/DragOperation.h>
#include <LibGUI/FontDatabase.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
@ -121,7 +122,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
if (font_entry == "default")
set_font(Gfx::Font::default_fixed_width_font());
else
set_font(Gfx::Font::load_from_file(font_entry));
set_font(GUI::FontDatabase::the().get_by_name(font_entry));
m_line_height = font().glyph_height() + m_line_spacing;