Skip to content

Commit

Permalink
Make hypertext[] respect font size settings (#13858)
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Oct 16, 2023
1 parent 3c41195 commit 6fdc7e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/guiHyperText.cpp
Expand Up @@ -63,10 +63,16 @@ void ParsedText::Element::setStyle(StyleList &style)
this->hovercolor = color;

unsigned int font_size = std::atoi(style["fontsize"].c_str());

FontMode font_mode = FM_Standard;
if (style["fontstyle"] == "mono")
font_mode = FM_Mono;

// hypertext[] only accepts absolute font size values and has a hardcoded
// default font size of 16. This is the only way to make hypertext[]
// respect font size settings that I can think of.
font_size = myround(font_size / 16.0f * g_fontengine->getFontSize(font_mode));

FontSpec spec(font_size, font_mode,
is_yes(style["bold"]), is_yes(style["italic"]));

Expand Down

0 comments on commit 6fdc7e0

Please sign in to comment.