15 class IGUIEnvironment;
20#define FONT_SIZE_UNSPECIFIED 0xFFFFFFFF
39 return (
mode << 2) | (
static_cast<u8
>(
bold) << 1) |
static_cast<u8
>(
italic);
137 gui::IGUIEnvironment*
m_env =
nullptr;
Definition fontengine.h:49
static const FontMode m_currentMode
default font engine mode (fixed)
Definition fontengine.h:153
std::recursive_mutex m_font_mutex
mutex used to protect font init and cache
Definition fontengine.h:140
unsigned int getTextHeight(unsigned int font_size=FONT_SIZE_UNSPECIFIED, FontMode mode=FM_Unspecified)
get text width if a text for a specific font
Definition fontengine.h:70
irr::gui::IGUIFont * getFont(unsigned int font_size=FONT_SIZE_UNSPECIFIED, FontMode mode=FM_Unspecified)
Definition fontengine.h:59
gui::IGUIFont * initFont(const FontSpec &spec)
initialize a new TTF font
Definition fontengine.cpp:193
bool m_default_italic
Definition fontengine.h:150
unsigned int getTextHeight(const FontSpec &spec)
get text height for a specific font
Definition fontengine.cpp:122
~FontEngine()
Definition fontengine.cpp:57
gui::IGUIEnvironment * m_env
pointer to irrlicht gui environment
Definition fontengine.h:137
std::map< unsigned int, irr::gui::IGUIFont * > m_font_cache[FM_MaxMode<< 2]
internal storage for caching fonts of different size
Definition fontengine.h:143
bool m_default_bold
default bold and italic
Definition fontengine.h:149
void updateSkin()
update current minetest skin with font changes
Definition fontengine.cpp:176
unsigned int getFontSize(FontMode mode)
get font size for a specific mode
Definition fontengine.cpp:152
FontEngine(gui::IGUIEnvironment *env)
Definition fontengine.cpp:39
unsigned int getTextWidth(const std::wstring &text, unsigned int font_size=FONT_SIZE_UNSPECIFIED, FontMode mode=FM_Unspecified)
get text width if a text for a specific font
Definition fontengine.h:81
unsigned int getTextWidth(const std::wstring &text, const FontSpec &spec)
Definition fontengine.cpp:130
unsigned int getTextWidth(const std::string &text, unsigned int font_size=FONT_SIZE_UNSPECIFIED, FontMode mode=FM_Unspecified)
Definition fontengine.h:94
unsigned int m_default_size[FM_MaxMode]
default font size to use
Definition fontengine.h:146
irr::gui::IGUIFont * getFont(FontSpec spec)
Definition fontengine.cpp:80
unsigned int getTextWidth(const std::string &text, const FontSpec &spec)
Definition fontengine.h:89
void readSettings()
update internal parameters from settings
Definition fontengine.cpp:161
DISABLE_CLASS_COPY(FontEngine)
unsigned int getDefaultFontSize()
get default font size
Definition fontengine.cpp:147
unsigned int getLineHeight(unsigned int font_size=FONT_SIZE_UNSPECIFIED, FontMode mode=FM_Unspecified)
Definition fontengine.h:105
unsigned int getLineHeight(const FontSpec &spec)
get line height for a specific font (including empty room between lines)
Definition fontengine.cpp:138
void updateFontCache()
update content of font cache in case of a setting change made it invalid
Definition fontengine.cpp:185
void cleanCache()
clean cache
Definition fontengine.cpp:65
FontMode
Definition fontengine.h:22
@ FM_Standard
Definition fontengine.h:23
@ FM_MaxMode
Definition fontengine.h:26
@ FM_Unspecified
Definition fontengine.h:27
@ FM_Mono
Definition fontengine.h:24
@ _FM_Fallback
Definition fontengine.h:25
FontEngine * g_fontengine
interface to access main font engine
Definition fontengine.cpp:19
#define FONT_SIZE_UNSPECIFIED
Definition fontengine.h:20
Definition clientmap.h:30
std::wstring utf8_to_wide(std::string_view input)
Definition string.cpp:87
Definition fontengine.h:30
bool italic
Definition fontengine.h:45
bool bold
Definition fontengine.h:44
FontSpec(unsigned int font_size, FontMode mode, bool bold, bool italic)
Definition fontengine.h:31
unsigned int size
Definition fontengine.h:42
u16 getHash() const
Definition fontengine.h:37
FontMode mode
Definition fontengine.h:43