[SOLVED] Font Texture, Same Size, Same Characters, Different File Size

I have uploaded a font which support chinese, at the beginning, the font file size was ~20MB total, which included 4 pngs for text mesh and each ~4MB, but after i added some symbols like “「」。”, it added one more texture which is make sense.

However, the 4 regenerated texture raise up to 16MB each, i’ve check the different, all the same
texture size 4096 x 4096 , each character is 64 x 64, color mode RGBs

now, no matter i reset the font character back to the same as before, or even i delete the font and reupload it, it never back to 20MB total anymore

any ideas ?

That’s interesting. Would you be able to share the font texture files for me to compare against each other please?

Can you also share the characters that you used to generate the font files for us to try to repro the issue?

CC’ing @slimbuck

Font Texture Here

=================
My guess is

the texture was only 2 bit texture, black and white only, 4096x4096x4 = 4MB
and somehow it turns to 8bit texture, so 4096 x 4096 x 8 = 16MB

=================

Update:

I’ve change the texture from 16bit channel to 8bit channel using photoshop, and then replace the png on hosting server, seems looks good.

I’m unable to reproduce the issue unfortunately. Would you be able to provide steps that can reproduce this 100% please? That will help us a lot!

Looking at the file differences between the two, it looks like the same character set but the precision is different

Any ideas here @slimbuck ?

I can’t reproduce it anymore, now it will 100% render the font texture in 16bit channel so it cost ~16MB each. and my hack fix is download the build as zip, unzip and find those font textures and using photoshop to change the image to 8bit channel manually, it could reduce the file size to ~5MB each. and then upload to hosting server to launch.

2 Likes

As @Calvin2274 says - the new PNG is 16 bit! This is pretty serious, will investigate.

2 Likes

Just to be clear: the old PNG was generated with 8 bit RGBA channels. The new PNG is being generated with 16-bit RGBA channels. (But in both cases they are being lossless-compressed @Calvin2274).

Created a ticket to track this: Font tool is creating 16bit PNGs instead of 8bit, making 4x larger · Issue #766 · playcanvas/editor · GitHub

1 Like

We have a fix for this on our end @Calvin2274. We need to test the changes then will update PROD.

Thanks so much for raising the issue and providing easy repro!

The fix has been released, you should be able to process the font in the Editor and it be much smaller

1 Like