mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 19:37:34 +00:00
LibVT: only use default bold font if it's the same size as our font
When the new font is a different size, just use that font for bold glyphs as well. It would be nice to find a matching bold version of the new font automatically in the future.
This commit is contained in:
parent
d4d17ce423
commit
24b8a27190
2 changed files with 14 additions and 1 deletions
|
@ -340,7 +340,7 @@ void TerminalWidget::paint_event(GPaintEvent& event)
|
||||||
painter.draw_glyph_or_emoji(
|
painter.draw_glyph_or_emoji(
|
||||||
character_rect.location(),
|
character_rect.location(),
|
||||||
codepoint,
|
codepoint,
|
||||||
attribute.flags & VT::Attribute::Bold ? Font::default_bold_fixed_width_font() : font(),
|
attribute.flags & VT::Attribute::Bold ? bold_font() : font(),
|
||||||
lookup_color(should_reverse_fill_for_cursor_or_selection ? attribute.background_color : attribute.foreground_color));
|
lookup_color(should_reverse_fill_for_cursor_or_selection ? attribute.background_color : attribute.foreground_color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,6 +667,15 @@ void TerminalWidget::did_change_font()
|
||||||
{
|
{
|
||||||
GFrame::did_change_font();
|
GFrame::did_change_font();
|
||||||
m_line_height = font().glyph_height() + m_line_spacing;
|
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 Font& bold_font = Font::default_bold_fixed_width_font();
|
||||||
|
|
||||||
|
if (bold_font.glyph_height() == font().glyph_height() && bold_font.glyph_width(' ') == font().glyph_width(' '))
|
||||||
|
m_bold_font = &bold_font;
|
||||||
|
else
|
||||||
|
m_bold_font = font();
|
||||||
|
|
||||||
if (!size().is_empty())
|
if (!size().is_empty())
|
||||||
relayout(size());
|
relayout(size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
|
|
||||||
void apply_size_increments_to_window(GWindow&);
|
void apply_size_increments_to_window(GWindow&);
|
||||||
|
|
||||||
|
const Font& bold_font() const { return *m_bold_font; }
|
||||||
|
|
||||||
void set_opacity(u8);
|
void set_opacity(u8);
|
||||||
float opacity() { return m_opacity; };
|
float opacity() { return m_opacity; };
|
||||||
bool should_beep() { return m_should_beep; }
|
bool should_beep() { return m_should_beep; }
|
||||||
|
@ -120,6 +122,8 @@ private:
|
||||||
bool m_cursor_blink_state { true };
|
bool m_cursor_blink_state { true };
|
||||||
bool m_automatic_size_policy { false };
|
bool m_automatic_size_policy { false };
|
||||||
|
|
||||||
|
RefPtr<Font> m_bold_font;
|
||||||
|
|
||||||
int m_glyph_width { 0 };
|
int m_glyph_width { 0 };
|
||||||
|
|
||||||
RefPtr<CTimer> m_cursor_blink_timer;
|
RefPtr<CTimer> m_cursor_blink_timer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue