font: Reset font family correctly in several places

Instead of assuming it's already set to a correct value.

Closes #5712.
This commit is contained in:
Iris Morelle 2021-04-15 16:23:25 -04:00
parent adf39d3d4a
commit e3838ccaa5
3 changed files with 11 additions and 5 deletions

View File

@ -2897,7 +2897,8 @@ void display::refresh_report(const std::string& report_name, const config * new_
}
text.set_link_aware(false)
.set_text(t, true);
text.set_font_size(item->font_size())
text.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(item->font_size())
.set_font_style(font::pango_text::STYLE_NORMAL)
.set_alignment(PANGO_ALIGN_LEFT)
.set_foreground_color(item->font_rgb_set() ? item->font_rgb() : font::NORMAL_COLOR)

View File

@ -95,6 +95,7 @@ surface floating_label::create_surface()
font::pango_text& text = font::get_text_renderer();
text.set_link_aware(false)
.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(font_size_)
.set_font_style(font::pango_text::STYLE_NORMAL)
.set_alignment(PANGO_ALIGN_LEFT)

View File

@ -46,7 +46,8 @@ surface pango_render_text(const std::string& text, int size, const color_t& colo
auto& ptext = private_renderer();
ptext.set_text(text, use_markup);
ptext.set_font_size(size)
ptext.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(size)
.set_font_style(style)
.set_maximum_height(-1, false)
.set_foreground_color(color)
@ -61,7 +62,8 @@ std::pair<int, int> pango_line_size(const std::string& line, int font_size, font
auto& ptext = private_renderer();
ptext.set_text(line, false);
ptext.set_font_size(font_size)
ptext.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(font_size)
.set_font_style(font_style)
.set_maximum_height(-1, false)
.set_maximum_width(-1)
@ -113,7 +115,8 @@ std::string pango_word_wrap(const std::string& unwrapped_text, int font_size, in
auto& ptext = private_renderer();
ptext.set_text(unwrapped_text, false);
ptext.set_font_size(font_size)
ptext.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(font_size)
.set_font_style(font::pango_text::STYLE_NORMAL)
.set_maximum_height(max_height, true)
.set_maximum_width(max_width)
@ -145,7 +148,8 @@ SDL_Rect pango_draw_text(surface& dst, const SDL_Rect& area, int size, const col
auto& ptext = private_renderer();
ptext.set_text(text, false);
ptext.set_font_size(size)
ptext.set_family_class(font::FONT_SANS_SERIF)
.set_font_size(size)
.set_font_style(style)
.set_maximum_width(-1)
.set_maximum_height(area.h, true)