msdf-bmfont-xml icon indicating copy to clipboard operation
msdf-bmfont-xml copied to clipboard

Error making atlas out of multiple fonts again

Open BladePoint opened this issue 4 years ago • 5 comments

I am re-opening my previous issue, which still persists in version 2.5.4 on a Windows 10 administrator command prompt.

C:\>msdf-bmfont --reuse -o Atlas.png font1.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.4
outputType      : xml
filename        : Atlas.png
fontSize        : 42
charsetFile     : Unspecified, fallback to ASC-II
textureSize     : 2048,2048
texturePadding  : 1
border          : 0
distanceRange   : 4
fieldType       : msdf
roundDecimal    : 0
vector          : false
reuse           : true
smartSize       : false
pot             : false
square          : false
rot             : false
rtl             : false
fontFile        : font1.ttf
========================================
No valid charset file loaded, fallback to ASC-II
Warning: no bitmap for character ' ' (32), adding to font as empty

Generation complete!

wrote font file        :  font1.fnt
wrote cfg file         :  Atlas.cfg
wrote spritesheet[ 0 ] :  Atlas.png

C:\>msdf-bmfont -u Atlas.cfg font2.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.4
outputType      : xml
filename        : font2
fontSize        : 42
charsetFile     : Defined in [Atlas.cfg]
textureSize     : 2048,2048
texturePadding  : 1
border          : 0
distanceRange   : 4
fieldType       : msdf
roundDecimal    : 0
vector          : Defined in [Atlas.cfg]
reuse           : Atlas.cfg
smartSize       : Defined in [Atlas.cfg]
pot             : Defined in [Atlas.cfg]
square          : Defined in [Atlas.cfg]
rot             : Defined in [Atlas.cfg]
rtl             : Defined in [Atlas.cfg]
fontFile        : font2.ttf
========================================
File:  Atlas.cfg  not valid! Aborting...

I also tried specifying the full path for the like this, msdf-bmfont --reuse C:\Atlas.cfg font2.ttf but the result was the same.

BladePoint avatar Mar 14 '20 23:03 BladePoint

Can you post your font project and post here? So I can try to reproduce your problem. Thanks!

soimy avatar Mar 17 '20 03:03 soimy

Sure, here is a zippyshare link to a zip of font1.ttf, font2.tff, and the atlas.cfg. I should mention that msdf-bmfont-xml works great for me if I do only 1 font at a time. It only causes problems when I try to combine 2 fonts into 1 atlas. I know I could do it separately, then edit the 2 .png files into 1 atlas and edit the x and y coordinates in the .fnt file, but then the characters are not packed in as tightly and there is some wasted space.

Thank you for all your hard work!

BladePoint avatar Mar 17 '20 07:03 BladePoint

Hi, I have the same problem as blade-point. I would like to like to use 3 different Fonts to create one Atlas and .fnt file but get an error at the second command.

Is there any known workaround?

matse4 avatar Jun 03 '20 11:06 matse4

Same issue here...

c:\Users\pixtur\coding\node>msdf-bmfont --reuse -o atlas.png -m 512,256 -s 42 -r 3 -p 1 -t msdf Roboto-Black.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.4
outputType      : xml
filename        : atlas.png
fontSize        : 42
charsetFile     : Unspecified, fallback to ASC-II
textureSize     : 512,256
texturePadding  : 1
border          : 0
distanceRange   : 3
fieldType       : msdf
roundDecimal    : 0
vector          : false
reuse           : true
smartSize       : false
pot             : false
square          : false
rot             : false
rtl             : false
fontFile        : Roboto-Black.ttf
========================================
No valid charset file loaded, fallback to ASC-II
Warning: no bitmap for character ' ' (32), adding to font as empty

Generation complete!

wrote spritesheet[ 0 ] :  atlas.png
wrote cfg file         :  atlas.cfg
wrote font file        :  Roboto-Black.fnt

c:\Users\pixtur\coding\node>msdf-bmfont -v -u atlas.cfg -t sdf -p 0 -r 8 Roboto-Light.ttf

Using following settings
========================================
version         : msdf-bmfont-xml v2.5.4
outputType      : xml
filename        : Roboto-Light
fontSize        : 42
charsetFile     : Defined in [atlas.cfg]
textureSize     : 2048,2048
texturePadding  : 0
border          : 0
distanceRange   : 8
fieldType       : sdf
roundDecimal    : 0
vector          : true
reuse           : atlas.cfg
smartSize       : Defined in [atlas.cfg]
pot             : Defined in [atlas.cfg]
square          : Defined in [atlas.cfg]
rot             : Defined in [atlas.cfg]
rtl             : Defined in [atlas.cfg]
fontFile        : Roboto-Light.ttf
========================================
File:  atlas.cfg  not valid! Aborting...

This is the created config file: https://gist.github.com/pixtur/11a7ab0de236d491af79c31a22c7db93

Is there an earlier version, I could use as a work around?

pixtur avatar Jul 05 '20 16:07 pixtur

Hi @soimy, I got the same issue on Window 10 22H2 as well but it works fine on MacOS 13.6.7. It throws File ***.cfg not valid! Aborting... even using the relative path. The root cause came from is-invalid-path library. It return false even the path is correct. Could we use path.existsSync instead?

DauMoe avatar Jun 18 '24 07:06 DauMoe