Setting fontFace to filename (which can be an atlas_path string) if it exists, over path.basename(fontPath, path.extname(fontPath)); results in fontFace now being the full path if filename is a path.
Either let extracted filename take precedence:
const fontface = path.basename(fontPath, path.extname(fontPath)) || filename;
Or set fontFace afterwards (not sure if option X and Y is one and the same in all cases, depending on if fontPath is a Buffer or not).
There is some confusion regarding 2.5.3 and the latest changes done here regarding how fontFace is set: https://github.com/soimy/msdf-bmfont-xml/commit/6b659b4db492c3667ef0943cb5f43920d85790a1
Setting
fontFace
to filename (which can be an atlas_path string) if it exists, overpath.basename(fontPath, path.extname(fontPath));
results in fontFace now being the full path if filename is a path.Either let extracted filename take precedence:
const fontface = path.basename(fontPath, path.extname(fontPath)) || filename;
Or set fontFace afterwards (not sure if option X and Y is one and the same in all cases, depending on if fontPath is a Buffer or not).
Option X:
Option Y: