summaryrefslogtreecommitdiff
path: root/SharedGraphics/Font.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-06 14:06:40 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-06 14:06:40 +0100
commit66a5ddd94a78818eb6a56b8aec6e1040171fc8ed (patch)
tree6b72baf79308539b2196271812ee9e2c6f06d278 /SharedGraphics/Font.cpp
parente53cef02d5a66591efb2d85f9ca576dcfe7a5421 (diff)
downloadserenity-66a5ddd94a78818eb6a56b8aec6e1040171fc8ed.zip
More work on the variable-width font support.
Katica is now the default system font, and it looks quite nice. :^) I'm gonna need to refine the GTextBox movement stuff eventually, but it works well-enough for basic editing now.
Diffstat (limited to 'SharedGraphics/Font.cpp')
-rw-r--r--SharedGraphics/Font.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp
index 4399f0634a..990853a493 100644
--- a/SharedGraphics/Font.cpp
+++ b/SharedGraphics/Font.cpp
@@ -9,9 +9,6 @@
#include <LibC/errno.h>
#include <LibC/mman.h>
-static Font* s_default_font;
-static Font* s_default_bold_font;
-
struct [[gnu::packed]] FontFileHeader {
char magic[4];
byte glyph_width;
@@ -24,7 +21,8 @@ struct [[gnu::packed]] FontFileHeader {
Font& Font::default_font()
{
- static const char* default_font_path = "/res/fonts/CsillaThin7x10.font";
+ static Font* s_default_font;
+ static const char* default_font_path = "/res/fonts/Katica10.font";
if (!s_default_font) {
s_default_font = Font::load_from_file(default_font_path).leak_ref();
ASSERT(s_default_font);
@@ -32,8 +30,20 @@ Font& Font::default_font()
return *s_default_font;
}
+Font& Font::default_fixed_width_font()
+{
+ static Font* s_default_fixed_width_font;
+ static const char* default_fixed_width_font_path = "/res/fonts/CsillaThin7x10.font";
+ if (!s_default_fixed_width_font) {
+ s_default_fixed_width_font = Font::load_from_file(default_fixed_width_font_path).leak_ref();
+ ASSERT(s_default_fixed_width_font);
+ }
+ return *s_default_fixed_width_font;
+}
+
Font& Font::default_bold_font()
{
+ static Font* s_default_bold_font;
static const char* default_bold_font_path = "/res/fonts/CsillaBold7x10.font";
if (!s_default_bold_font) {
s_default_bold_font = Font::load_from_file(default_bold_font_path).leak_ref();