mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-30 20:53:45 +01:00
@@ -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;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
#include "irr_ptr.h"
|
||||
#include "IGUIEnvironment.h"
|
||||
#include "IGUIFont.h"
|
||||
#include "IVideoDriver.h"
|
||||
@@ -266,7 +267,7 @@ namespace gui
|
||||
u32 getLastGlyphPageIndex() const { return Glyph_Pages.size() - 1; }
|
||||
|
||||
//! Set font that should be used for glyphs not present in ours
|
||||
void setFallback(gui::IGUIFont* font) { fallback = font; }
|
||||
void setFallback(gui::IGUIFont *font);
|
||||
|
||||
inline s32 getAscender() const { return font_metrics.ascender; }
|
||||
|
||||
@@ -329,7 +330,7 @@ namespace gui
|
||||
u32 shadow_offset = 0;
|
||||
u32 shadow_alpha = 0;
|
||||
|
||||
gui::IGUIFont *fallback = nullptr;
|
||||
irr_ptr<gui::IGUIFont> fallback;
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
|
||||
Reference in New Issue
Block a user