Make FontWrapper conditional

This commit is contained in:
Evil Eye 2023-05-21 18:21:42 +02:00
parent 492e336c0c
commit 4e05dd3cd3

View File

@ -1,6 +1,7 @@
#ifndef OPENMW_WIDGETS_WRAPPER_H #ifndef OPENMW_WIDGETS_WRAPPER_H
#define OPENMW_WIDGETS_WRAPPER_H #define OPENMW_WIDGETS_WRAPPER_H
#include <MyGUI_Prerequest.h>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <algorithm> #include <algorithm>
@ -10,6 +11,7 @@ namespace Gui
template <class T> template <class T>
class FontWrapper : public T class FontWrapper : public T
{ {
#if MYGUI_VERSION <= MYGUI_DEFINE_VERSION(3, 4, 2)
public: public:
void setFontName(const std::string& name) override void setFontName(const std::string& name) override
{ {
@ -22,6 +24,7 @@ namespace Gui
{ {
T::setPropertyOverride(_key, _value); T::setPropertyOverride(_key, _value);
// https://github.com/MyGUI/mygui/issues/113
// There is a bug in MyGUI: when it initializes the FontName property, it reset the font height. // There is a bug in MyGUI: when it initializes the FontName property, it reset the font height.
// We should restore it. // We should restore it.
if (_key == "FontName") if (_key == "FontName")
@ -31,7 +34,7 @@ namespace Gui
} }
private: private:
std::string getFontSize() const std::string& getFontSize()
{ {
// Note: we can not use the FontLoader here, so there is a code duplication a bit. // Note: we can not use the FontLoader here, so there is a code duplication a bit.
static const std::string fontSize static const std::string fontSize
@ -39,6 +42,7 @@ namespace Gui
return fontSize; return fontSize;
} }
}; };
#endif
} }
#endif #endif