mirror of https://github.com/AxioDL/metaforce.git
Don't defeat font texture cache
This commit is contained in:
parent
7a0dcbbf03
commit
85861cc24c
|
@ -56,7 +56,6 @@ using FCharFilter = std::pair<std::string, std::function<bool(uint32_t)>>;
|
||||||
|
|
||||||
class FontAtlas
|
class FontAtlas
|
||||||
{
|
{
|
||||||
friend class FontCache;
|
|
||||||
FT_Face m_face;
|
FT_Face m_face;
|
||||||
std::vector<uint8_t> m_texmap;
|
std::vector<uint8_t> m_texmap;
|
||||||
boo::ObjToken<boo::ITextureSA> m_tex;
|
boo::ObjToken<boo::ITextureSA> m_tex;
|
||||||
|
@ -128,6 +127,7 @@ public:
|
||||||
FT_Fixed FT_Xscale() const {return m_ftXscale;}
|
FT_Fixed FT_Xscale() const {return m_ftXscale;}
|
||||||
FT_UShort FT_XPPem() const {return m_ftXPpem;}
|
FT_UShort FT_XPPem() const {return m_ftXPpem;}
|
||||||
FT_Pos FT_LineHeight() const {return m_lineHeight;}
|
FT_Pos FT_LineHeight() const {return m_lineHeight;}
|
||||||
|
bool isReady() const { return m_ready; }
|
||||||
boo::ObjToken<boo::ITextureSA> texture(boo::IGraphicsDataFactory* gf) const;
|
boo::ObjToken<boo::ITextureSA> texture(boo::IGraphicsDataFactory* gf) const;
|
||||||
bool subpixel() const {return m_subpixel;}
|
bool subpixel() const {return m_subpixel;}
|
||||||
|
|
||||||
|
|
|
@ -721,7 +721,7 @@ FontTag FontCache::prepCustomFont(std::string_view name, FT_Face face,
|
||||||
if (r.position() == 4 && magic == 'FONT')
|
if (r.position() == 4 && magic == 'FONT')
|
||||||
{
|
{
|
||||||
std::unique_ptr<FontAtlas> fa = std::make_unique<FontAtlas>(face, dpi, subpixel, filter, r);
|
std::unique_ptr<FontAtlas> fa = std::make_unique<FontAtlas>(face, dpi, subpixel, filter, r);
|
||||||
if (fa->m_tex)
|
if (fa->isReady())
|
||||||
{
|
{
|
||||||
m_cachedAtlases.emplace(tag, std::move(fa));
|
m_cachedAtlases.emplace(tag, std::move(fa));
|
||||||
return tag;
|
return tag;
|
||||||
|
|
Loading…
Reference in New Issue