Don't defeat font texture cache

This commit is contained in:
Jack Andersen 2018-01-13 20:43:55 -10:00
parent 7a0dcbbf03
commit 85861cc24c
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,6 @@ using FCharFilter = std::pair<std::string, std::function<bool(uint32_t)>>;
class FontAtlas
{
friend class FontCache;
FT_Face m_face;
std::vector<uint8_t> m_texmap;
boo::ObjToken<boo::ITextureSA> m_tex;
@ -128,6 +127,7 @@ public:
FT_Fixed FT_Xscale() const {return m_ftXscale;}
FT_UShort FT_XPPem() const {return m_ftXPpem;}
FT_Pos FT_LineHeight() const {return m_lineHeight;}
bool isReady() const { return m_ready; }
boo::ObjToken<boo::ITextureSA> texture(boo::IGraphicsDataFactory* gf) const;
bool subpixel() const {return m_subpixel;}

View File

@ -721,7 +721,7 @@ FontTag FontCache::prepCustomFont(std::string_view name, FT_Face face,
if (r.position() == 4 && magic == 'FONT')
{
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));
return tag;