From 6fdc7e0dad2997ca4f1a4e0cf9a1ce8e3ebaa1d4 Mon Sep 17 00:00:00 2001 From: Gregor Parzefall <82708541+grorp@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:47:16 +0200 Subject: [PATCH] Make hypertext[] respect font size settings (#13858) --- src/gui/guiHyperText.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/guiHyperText.cpp b/src/gui/guiHyperText.cpp index d50a6cc7f..23b7d05a1 100644 --- a/src/gui/guiHyperText.cpp +++ b/src/gui/guiHyperText.cpp @@ -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"]));