Font atlas texture initialization delayed (#19592)

This commit is contained in:
minggo 2019-04-10 18:31:29 -07:00 committed by GitHub
parent df88380394
commit 0a9e66a16c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -73,8 +73,6 @@ FontAtlas::FontAtlas(Font &theFont)
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
}
reinit();
#if CC_ENABLE_CACHE_TEXTURE_DATA
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
@ -370,7 +368,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
if (_fontFreeType == nullptr)
{
return false;
}
}
if (!_currentPageData)
reinit();
std::unordered_map<unsigned int, unsigned int> codeMapOfNewChar;
findNewCharacters(utf32Text, codeMapOfNewChar);