Hi Everyone!
When i try to load custom font (font.fnt), it gives me an error like "no such file or directory, ... font.png". Even if it is not a .png file, error says it is an .png file.
Could anyone help me to overcome this problem please?
CODE
Jimp.loadFont('font.fnt').then(function (font) {
baseImage.print(font, 10, 10, "Hello World!");
baseImage.write("output.png");
});
ERROR
(node:6476) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open 'C:UsersUSERNAMEDesktopjimp-exfont.png'
(node:6476) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+1, I have exactly the same problem
It's coming from your .fnt generator, not the library.
Where did you generate your .fnt?
You should have received a .png with it.
If you open your .fnt file with your text editor, you'll notice there is a reference to the font.png file that contains all the glyphs.
Documenting this in the hope of helping someone in the future.
If you're using BMFont generator from angelcode, go into the 'Export options' menu via _Options_ -> _Export Options_ or by pressing T.
Then:
And all should be good!
Future Jimp users .
Don't use BMFont generator cuz that i converted my ttf and otf fonts with it and result was not good . Font converted but with black background frame .
陌nstead of BMFont generator use Hiero converter it is much better .
Most helpful comment
Future Jimp users .
Don't use BMFont generator cuz that i converted my ttf and otf fonts with it and result was not good . Font converted but with black background frame .
陌nstead of BMFont generator use Hiero converter it is much better .