Make hypertext[] respect font size settings (#13858)

This commit is contained in:
Gregor Parzefall 2023-10-16 20:47:16 +02:00 committed by GitHub
parent 3c41195986
commit 6fdc7e0dad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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"]));