mirror of
https://github.com/minetest/minetest.git
synced 2025-02-18 19:03:46 +01:00
Make hypertext[] respect font size settings (#13858)
This commit is contained in:
@ -63,10 +63,16 @@ void ParsedText::Element::setStyle(StyleList &style)
|
|||||||
this->hovercolor = color;
|
this->hovercolor = color;
|
||||||
|
|
||||||
unsigned int font_size = std::atoi(style["fontsize"].c_str());
|
unsigned int font_size = std::atoi(style["fontsize"].c_str());
|
||||||
|
|
||||||
FontMode font_mode = FM_Standard;
|
FontMode font_mode = FM_Standard;
|
||||||
if (style["fontstyle"] == "mono")
|
if (style["fontstyle"] == "mono")
|
||||||
font_mode = FM_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,
|
FontSpec spec(font_size, font_mode,
|
||||||
is_yes(style["bold"]), is_yes(style["italic"]));
|
is_yes(style["bold"]), is_yes(style["italic"]));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user