X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Ffontengine.h;h=78608e517906c2f2471e68807af8608648def98d;hb=a4ef62f5b215fe0f23e3e50672f1538854db4ed9;hp=3d389ea48bfa32a1f51658fd2558aecc9f8cb92f;hpb=8d89f5f0cc1db47542bd355babad06b6bda54f51;p=minetest.git diff --git a/src/client/fontengine.h b/src/client/fontengine.h index 3d389ea48..78608e517 100644 --- a/src/client/fontengine.h +++ b/src/client/fontengine.h @@ -20,13 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include -#include #include "util/basic_macros.h" #include "irrlichttypes.h" #include #include #include #include "settings.h" +#include "threading/mutex_auto_lock.h" #define FONT_SIZE_UNSPECIFIED 0xFFFFFFFF @@ -34,8 +34,6 @@ enum FontMode : u8 { FM_Standard = 0, FM_Mono, _FM_Fallback, // do not use directly - FM_Simple, - FM_SimpleMono, FM_MaxMode, FM_Unspecified }; @@ -140,9 +138,6 @@ class FontEngine /** initialize a new TTF font */ gui::IGUIFont *initFont(const FontSpec &spec); - /** initialize a font without freetype */ - gui::IGUIFont *initSimpleFont(const FontSpec &spec); - /** update current minetest skin with font changes */ void updateSkin(); @@ -152,6 +147,9 @@ class FontEngine /** pointer to irrlicht gui environment */ gui::IGUIEnvironment* m_env = nullptr; + /** mutex used to protect font init and cache */ + std::recursive_mutex m_font_mutex; + /** internal storage for caching fonts of different size */ std::map m_font_cache[FM_MaxMode << 2]; @@ -162,8 +160,8 @@ class FontEngine bool m_default_bold = false; bool m_default_italic = false; - /** current font engine mode */ - FontMode m_currentMode = FM_Standard; + /** default font engine mode (fixed) */ + static const FontMode m_currentMode = FM_Standard; DISABLE_CLASS_COPY(FontEngine); };