Skip to content

Commit 0a9e66a

Browse files
author
minggo
authored
Font atlas texture initialization delayed (#19592)
1 parent df88380 commit 0a9e66a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cocos/2d/CCFontAtlas.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ FontAtlas::FontAtlas(Font &theFont)
7373
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
7474
}
7575

76-
reinit();
77-
7876
#if CC_ENABLE_CACHE_TEXTURE_DATA
7977
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
8078

@@ -370,7 +368,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
370368
if (_fontFreeType == nullptr)
371369
{
372370
return false;
373-
}
371+
}
372+
373+
if (!_currentPageData)
374+
reinit();
374375

375376
std::unordered_map<unsigned int, unsigned int> codeMapOfNewChar;
376377
findNewCharacters(utf32Text, codeMapOfNewChar);

0 commit comments

Comments
 (0)