diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-06 14:50:27 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-06 14:50:27 +0100 |
commit | 31d6b640eb2d7fcb529aa8c44426c26affc1c7b2 (patch) | |
tree | 10e352dab06962ee5576ca6c82b628456ab68723 | |
parent | 66a5ddd94a78818eb6a56b8aec6e1040171fc8ed (diff) | |
download | serenity-31d6b640eb2d7fcb529aa8c44426c26affc1c7b2.zip |
Add a bold variant of Katica and make that the system's default bold font.
..and do some minor tweaks to the font rendering code.
-rw-r--r-- | Base/res/fonts/Katica10.font | bin | 0 -> 10574 bytes | |||
-rw-r--r-- | Base/res/fonts/KaticaBold10.font | bin | 0 -> 10574 bytes | |||
-rw-r--r-- | LibGUI/GTextBox.cpp | 11 | ||||
-rw-r--r-- | SharedGraphics/Font.cpp | 2 | ||||
-rw-r--r-- | SharedGraphics/Font.h | 2 |
5 files changed, 10 insertions, 5 deletions
diff --git a/Base/res/fonts/Katica10.font b/Base/res/fonts/Katica10.font Binary files differnew file mode 100644 index 0000000000..092a506d00 --- /dev/null +++ b/Base/res/fonts/Katica10.font diff --git a/Base/res/fonts/KaticaBold10.font b/Base/res/fonts/KaticaBold10.font Binary files differnew file mode 100644 index 0000000000..7f6067f780 --- /dev/null +++ b/Base/res/fonts/KaticaBold10.font diff --git a/LibGUI/GTextBox.cpp b/LibGUI/GTextBox.cpp index 23302d77c1..5ebc962128 100644 --- a/LibGUI/GTextBox.cpp +++ b/LibGUI/GTextBox.cpp @@ -76,7 +76,7 @@ void GTextBox::paint_event(GPaintEvent& event) Painter painter(*this); painter.set_clip_rect(event.rect()); - painter.fill_rect({ rect().x() + 1, rect().y() + 1, rect().width() - 2, rect().height() - 2 }, background_color()); + painter.fill_rect(rect().shrunken(2, 2), background_color()); painter.draw_rect(rect(), foreground_color()); if (is_focused()) @@ -88,9 +88,9 @@ void GTextBox::paint_event(GPaintEvent& event) painter.set_clip_rect(inner_rect); painter.translate(-m_scroll_offset, 0); - int y = inner_rect.center().y() - font().glyph_height() / 2; int space_width = font().glyph_width(' ') + font().glyph_spacing(); int x = inner_rect.x(); + int y = inner_rect.center().y() - font().glyph_height() / 2; for (int i = 0; i < m_text.length(); ++i) { char ch = m_text[i]; @@ -103,7 +103,12 @@ void GTextBox::paint_event(GPaintEvent& event) } if (is_focused() && m_cursor_blink_state) { - Rect cursor_rect(inner_rect.x() + cursor_content_position().x(), inner_rect.y(), 1, inner_rect.height()); + Rect cursor_rect { + inner_rect.x() + cursor_content_position().x(), + inner_rect.y(), + 1, + inner_rect.height() + }; painter.fill_rect(cursor_rect, foreground_color()); } } diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp index 990853a493..aca394a3b6 100644 --- a/SharedGraphics/Font.cpp +++ b/SharedGraphics/Font.cpp @@ -44,7 +44,7 @@ Font& Font::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"; + static const char* default_bold_font_path = "/res/fonts/KaticaBold10.font"; if (!s_default_bold_font) { s_default_bold_font = Font::load_from_file(default_bold_font_path).leak_ref(); ASSERT(s_default_bold_font); diff --git a/SharedGraphics/Font.h b/SharedGraphics/Font.h index b0b479ac5c..e972974c78 100644 --- a/SharedGraphics/Font.h +++ b/SharedGraphics/Font.h @@ -54,7 +54,7 @@ public: ~Font(); - GlyphBitmap glyph_bitmap(char ch) const { return GlyphBitmap(&m_rows[(byte)ch * m_glyph_height], { m_glyph_width, m_glyph_height }); } + GlyphBitmap glyph_bitmap(char ch) const { return GlyphBitmap(&m_rows[(byte)ch * m_glyph_height], { glyph_width(ch), m_glyph_height }); } byte glyph_width(char ch) const { return m_fixed_width ? m_glyph_width : m_glyph_widths[(byte)ch]; } byte glyph_height() const { return m_glyph_height; } |