Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hypertext[] respect font size settings #13858

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/gui/guiHyperText.cpp
Original file line number Diff line number Diff line change
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