diff --git a/native/cocos/2d/CCFontAtlasCache.cpp b/native/cocos/2d/CCFontAtlasCache.cpp index 23f7d98b51..998db2cfa1 100644 --- a/native/cocos/2d/CCFontAtlasCache.cpp +++ b/native/cocos/2d/CCFontAtlasCache.cpp @@ -94,10 +94,8 @@ FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fntDataString, SpriteFrame* spriteFrame, const Vec2& imageOffset /* = Vec2::ZERO */) { - auto realFontFilename = spriteFrame->getTexture()->getPath(); - char tmp[ATLAS_MAP_KEY_BUFFER]; - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s %p", imageOffset.x, imageOffset.y, realFontFilename.c_str(), spriteFrame); + snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %p", imageOffset.x, imageOffset.y, spriteFrame); std::string atlasName = tmp; auto it = _atlasMap.find(atlasName); @@ -239,10 +237,8 @@ void FontAtlasCache::reloadFontAtlasFNT(const std::string& fntDataString, SpriteFrame* spriteFrame, const Vec2& imageOffset/* = Vec2::ZERO*/) { - auto realFontFilename = spriteFrame->getTexture()->getPath(); - char tmp[ATLAS_MAP_KEY_BUFFER]; - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s", imageOffset.x, imageOffset.y, realFontFilename.c_str()); + snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %p", imageOffset.x, imageOffset.y, spriteFrame); std::string atlasName = tmp; auto it = _atlasMap.find(atlasName);