Fix crash with fixed pipeline
This commit is contained in:
parent
6a319cbed2
commit
89f06ed8d3
@ -411,14 +411,6 @@
|
||||
which leads to crash with STK), but the fonts are to blame, what's the point of not
|
||||
using industry standard nowadays...
|
||||
-->
|
||||
<font default="Cantarell-Regular.otf"
|
||||
default_fallback="FreeSans.ttf"
|
||||
cjk="wqy-microhei.ttf"
|
||||
ar="NotoNaskhArabicUI-Bold.ttf"
|
||||
bold="Cantarell-Bold.otf"
|
||||
bold_fallback="FreeSansBold.ttf"
|
||||
digit="SigmarOne.otf" />
|
||||
|
||||
<fonts-list regular-faces="Cantarell-Regular.otf FreeSans.ttf NotoSansCJK-Regular.ttc NotoNaskhArabicUI-Bold.ttf"
|
||||
bold-faces="Cantarell-Bold.otf FreeSansBold.ttf NotoSansCJK-Bold.ttc"
|
||||
digit-faces="SigmarOne.otf" />
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "font/bold_face.hpp"
|
||||
#include "font/digit_face.hpp"
|
||||
#include "font/regular_face.hpp"
|
||||
#include "utils/leak_check.hpp"
|
||||
|
||||
FontManager *font_manager = NULL;
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -60,5 +59,3 @@ void FontManager::checkFTError(FT_Error err, const std::string& desc) const
|
||||
Log::error("FontManager", "Something wrong when %s!", desc.c_str());
|
||||
}
|
||||
} // checkFTError
|
||||
|
||||
// ----------------------------------------------------------------------------
|
@ -68,6 +68,7 @@ public:
|
||||
void loadFonts();
|
||||
// ------------------------------------------------------------------------
|
||||
FT_Library getFTLibrary() const { return m_ft_library; }
|
||||
|
||||
}; // FontManager
|
||||
|
||||
extern FontManager *font_manager;
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
void setRTL(bool rtl) { m_rtl = rtl; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isRTL() const { return m_rtl; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
}; // FontSettings
|
||||
|
||||
#endif
|
||||
|
@ -435,7 +435,7 @@ void FontWithFace::render(const core::stringw& text,
|
||||
shadowpos.LowerRightCorner.X += 2;
|
||||
shadowpos.LowerRightCorner.Y += 2;
|
||||
render(text, shadowpos, font_settings->getShadowColor(), hcenter,
|
||||
vcenter, clip);
|
||||
vcenter, clip, font_settings);
|
||||
|
||||
// Set back
|
||||
font_settings->setShadow(true);
|
||||
|
@ -41,6 +41,17 @@ public:
|
||||
const video::SColor* const colors) = 0;
|
||||
};
|
||||
|
||||
struct FontArea
|
||||
{
|
||||
FontArea() : advance_x(0), bearing_x(0) ,offset_y(0), offset_y_bt(0),
|
||||
spriteno(0) {}
|
||||
int advance_x;
|
||||
int bearing_x;
|
||||
int offset_y;
|
||||
int offset_y_bt;
|
||||
int spriteno;
|
||||
};
|
||||
|
||||
protected:
|
||||
std::vector<FT_Face> m_faces;
|
||||
|
||||
@ -82,17 +93,6 @@ protected:
|
||||
void setFallbackFontScale(float scale) { m_fallback_font_scale = scale; }
|
||||
|
||||
private:
|
||||
struct FontArea
|
||||
{
|
||||
FontArea() : advance_x(0), bearing_x(0) ,offset_y(0), offset_y_bt(0),
|
||||
spriteno(0) {}
|
||||
int advance_x;
|
||||
int bearing_x;
|
||||
int offset_y;
|
||||
int offset_y_bt;
|
||||
int spriteno;
|
||||
};
|
||||
|
||||
struct GlyphInfo
|
||||
{
|
||||
unsigned int font_number;
|
||||
@ -179,8 +179,6 @@ private:
|
||||
// ------------------------------------------------------------------------
|
||||
unsigned int getDPI() const;
|
||||
// ------------------------------------------------------------------------
|
||||
gui::IGUISpriteBank* getSpriteBank() const { return m_spritebank; }
|
||||
// ------------------------------------------------------------------------
|
||||
void addLazyLoadChar(wchar_t c) { m_new_char_holder.insert(c); }
|
||||
// ------------------------------------------------------------------------
|
||||
void insertGlyph(wchar_t c, const GlyphInfo& gi);
|
||||
@ -196,10 +194,6 @@ private:
|
||||
virtual std::vector<std::string> getFacesList() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
virtual unsigned int getVerticalDrawOffset() const { return 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
const FontArea& getAreaFromCharacter(const wchar_t c,
|
||||
bool* fallback_font) const;
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
LEAK_CHECK();
|
||||
@ -221,7 +215,7 @@ public:
|
||||
void render(const core::stringw& text, const core::rect<s32>& position,
|
||||
const video::SColor& color, bool hcenter, bool vcenter,
|
||||
const core::rect<s32>* clip,
|
||||
FontSettings* font_settings = NULL,
|
||||
FontSettings* font_settings,
|
||||
FontCharCollector* char_collector = NULL);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Write the current glyph page in png inside current running directory.
|
||||
@ -234,6 +228,11 @@ public:
|
||||
* Useful in gdb without parameter.
|
||||
*/
|
||||
void dumpGlyphPage();
|
||||
// ------------------------------------------------------------------------
|
||||
gui::IGUISpriteBank* getSpriteBank() const { return m_spritebank; }
|
||||
// ------------------------------------------------------------------------
|
||||
const FontArea& getAreaFromCharacter(const wchar_t c,
|
||||
bool* fallback_font) const;
|
||||
|
||||
}; // FontWithFace
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
|
||||
#include "font/font_manager.hpp"
|
||||
#include "font/font_with_face.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
@ -110,5 +109,19 @@ s32 ScalableFont::getCharacterFromPos(const wchar_t* text, s32 pixel_x) const
|
||||
return m_face->getCharacterFromPos(text, pixel_x, m_font_settings);
|
||||
} // getCharacterFromPos
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
IGUISpriteBank* ScalableFont::getSpriteBank() const
|
||||
{
|
||||
return m_face->getSpriteBank();
|
||||
} // getSpriteBank
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
u32 ScalableFont::getSpriteNoFromChar(const wchar_t *c) const
|
||||
{
|
||||
const FontWithFace::FontArea& area =
|
||||
m_face->getAreaFromCharacter(*c, NULL/*fallback_font*/);
|
||||
return area.spriteno;
|
||||
} // getSpriteNoFromChar
|
||||
|
||||
} // end namespace gui
|
||||
} // end namespace irr
|
||||
|
@ -80,6 +80,12 @@ public:
|
||||
/** Returns the type of this font */
|
||||
virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** gets the sprite bank */
|
||||
virtual IGUISpriteBank* getSpriteBank() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** returns the sprite number from a given character */
|
||||
virtual u32 getSpriteNoFromChar(const wchar_t *c) const;
|
||||
// ------------------------------------------------------------------------
|
||||
// Below is not used:
|
||||
/** set an Pixel Offset on Drawing ( scale position on width ) */
|
||||
virtual void setKerningWidth (s32 kerning) {}
|
||||
@ -93,12 +99,6 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
virtual s32 getKerningHeight() const { return 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** gets the sprite bank */
|
||||
virtual IGUISpriteBank* getSpriteBank() const { return NULL; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** returns the sprite number from a given character */
|
||||
virtual u32 getSpriteNoFromChar(const wchar_t *c) const { return 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void setInvisibleCharacters( const wchar_t *s ) {}
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user