Canvas custom font not registering
Hello i use
node-canvas
in my discord bot but when register font locally it works but when its deployed it don't, any tips why?
It just make the text with the default font39 Replies
Project ID:
628e9bd7-1359-4b90-aa85-0c48855bd942
628e9bd7-1359-4b90-aa85-0c48855bd942
it's likely that your path is just incorrect
@Vin do you see what could be causing the font to not get loaded?
Unfortunately, I’m not too familiar with node-canvas
I’d have to play with it and see what’s going on
but is that a proper path? looks like it could be simplified?
The way it’s being called there feels like it would be treated as a system font, instead of an imported one
If it can’t find it, it will default to actual system fonts
@marasorg - are you providing this font in your repo?
This doesn’t look promising
![](https://answer-overflow-discord-attachments.s3.amazonaws.com/1130896759221133332/IMG_0301.png)
No docs
this is more likely the correct package
https://www.npmjs.com/package/canvas
They said
node-canvas
not canvas
maybe the path is correct, but the container is missing the lib that would read the font file?
![](https://answer-overflow-discord-attachments.s3.amazonaws.com/1130897323497627749/Screenshot_2023-07-18-12-22-02-235_com.android.chrome.jpg)
npm names are confusing
this would still count as
node-canvas
This is why I don’t use node
fair
register font doesn't return an error 🙄
But according to the canvas docs, the implementation is correct
correct, though probably sub optimal import path
Might be time to throw some
console.log()
statements. Unless someone familiar with the package knows what’s going onno one is familiar with npm packages
Fair
yea
im working on a test, will get back to you!
![](https://answer-overflow-discord-attachments.s3.amazonaws.com/1130918264114008246/image.png)
thx!
what do you use?
he uses perl
oh
sometimes even assembly if he feels like it
im not even joking
He’s really not joking. Perl, python, PHP, go, c#, you name it
and thats only a tiny fraction of the languages
@marasorg - https://test-service2.up.railway.app/
Solution
wait... i will check it
The register was no err but while generating image i got
yeah I got that on windows too, but works fine on railway as you can see by my demo site
i will try it, wait
Its working, thanks!
no problem!