1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-16 12:05:26 +01:00

Fix missing reference count for fallback font

closes #16696
This commit is contained in:
sfan5
2025-11-25 21:38:18 +01:00
parent 77ce40cf44
commit cd79a91178
2 changed files with 11 additions and 5 deletions

View File

@@ -33,7 +33,6 @@
#include "CGUITTFont.h"
#include "irr_ptr.h"
#include "log.h"
#include "debug.h"
#include "IGUIEnvironment.h"
@@ -445,6 +444,12 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8 pixel_mode)
return page;
}
void CGUITTFont::setFallback(gui::IGUIFont *font)
{
sanity_check(font != this);
fallback.grab(font);
}
void CGUITTFont::setMonochrome(const bool flag)
{
use_monochrome = flag;
@@ -703,7 +708,7 @@ inline u32 CGUITTFont::getWidthFromCharacter(char32_t c) const
int w = Glyphs[n-1].advance.X / 64;
return w;
}
if (fallback != 0)
if (fallback)
{
wchar_t s[] = { (wchar_t) c, 0 };
return fallback->getDimension(s).Width;
@@ -723,7 +728,7 @@ inline u32 CGUITTFont::getHeightFromCharacter(char32_t c) const
s32 height = (font_metrics.ascender / 64) - Glyphs[n-1].offset.Y + Glyphs[n-1].source_rect.getHeight();
return height;
}
if (fallback != 0)
if (fallback)
{
wchar_t s[] = { (wchar_t) c, 0 };
return fallback->getDimension(s).Height;