Multiple same bmfont image in dynamic atlas - v2.4.3

When I created object using bmfont I realize dynamic atlas contain multiple image of that same font.


Why dynamic atlas manager keep merging the same font instead of reuse the old one? is it a bug? Thank you in advance.

I will ask engineering to have a look.

1 Like

When rendering to a texture, the Dynamic Atlas Manager will automatically detects if the texture has been merged into the atlas (Collection of images). If not, and the texture conforms to the Dynamic Atlas condition, then the texture will be merged into the atlas.

Yeah I know that. But after google around I think this issue is related to other issue about bitmap font turn to black box in cocos v2.4.3
The above image is the result of Dynamic Atlas Manager showDebug function. Maybe the picture of bmfont was destroyed accidentally, so It will merge the same picture font to the atlas.
I tried using cocos v2.4.6 and the issue is solved.

Applagies let me update this was a saterday night.

I load mine to a MySpriteSheet.plist MySpriteSheet.png ,using TexturePacker
Then in the YourBMIfonFile.fnt file in your resourse/fonts I change the text line from
file="…/YourBMIfonFile.png" , file="…/MySpriteSheet.png"

Then call like this.
auto offset=SpriteFrameCache::getInstance()->getSpriteFrameByName(“YourBMIfonFile_0.png”)->getRectInPixels().origin;
auto label = Label::createWithBMFont(“fonts/YourBMIfonFile.fnt”, “Hello World”, alignment , 0, offset);

then add the child.

The only thing I have had with its not showing correctly is if i use the Polygon settings not a bug i just can’t be botherd sort out the ammount trimming in polygon mode of TexturePacker , so i use maxrects, perfict many text all on one layer.

Im using cocos2dx V3.17.2

Can you provide an test project? first look at your usage of the component.

Yeah goto my website I be providing souce soon i’m woking on Draw nodes at the moment
but have a demo apk on my website at www.gamesstudiotwo.com

as you can see many text on diffrent levels on diffrent nodes but only 1 layer.

bmfont-error.zip (926.9 KB)
Here is the test project in cocos 2.4.3. Click the button to asign new string value to label, show it then hide. The font image merge to dynamic atlas each time I click the button.

Upgrade to version 2.4.6, this problem has not recurred anymore.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.