mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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.
This commit is contained in:
parent
66a5ddd94a
commit
31d6b640eb
Notes:
sideshowbarker
2024-07-19 15:09:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/31d6b640eb2
5 changed files with 10 additions and 5 deletions
BIN
Base/res/fonts/Katica10.font
Normal file
BIN
Base/res/fonts/Katica10.font
Normal file
Binary file not shown.
BIN
Base/res/fonts/KaticaBold10.font
Normal file
BIN
Base/res/fonts/KaticaBold10.font
Normal file
Binary file not shown.
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in a new issue