question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load Custom Font Error

See original GitHub issue

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:\Users\USERNAME\Desktop\jimp-ex\font.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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
Adron55commented, Jul 31, 2019

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 .

  • U can change color of font
  • U can change size of font
  • and etc. what i haven’t used yet
5reactions
gacardinalcommented, Apr 6, 2019

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:

  • Set the font description to XML
  • Set the textures to PNG

And all should be good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does the android studio gives me an error when I add the ...
Try this: You have to create a folder named font inside the res folder and copy your font inside the new folder.
Read more >
Custom font is failing to load for existing project #2374 - GitHub
Steps to reproduce the behavior: Create a document with a custom font; Update the page; The texts that used the custom font are...
Read more >
How to load web fonts to avoid performance issues and speed ...
Use the correct font format; Preload fonts; Use the correct font-face declaration; Avoid invisible text during font loading. Let's break down ...
Read more >
Error loading custom font? : r/godot - Reddit
I tried that and found where it shows the custom font in the project.godot file, and then deleted that line. But, fascinating to...
Read more >
Custom Fonts Not Displaying On Front End - Elementor
In order to fix this issue, you can use the Generator tool from Font Squirrel. From there, you can check options as shown...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found