Fontconfig error: Cannot load default config file Node.js Canvas
I cant use the fillText method in a canvas image (its for a discord bot) the letters are replaced by squares
OyunMknats1
I get same problem, I tried use registerFont but gives same error again, I tried with 3-4 font file( .ttf )
JohnFelicisimo
This is also my problem, I used heroku before, and just by making a directory named '.fonts' and putting my downloaded fonts there, everything works perfectly. I don't even use registerfonts.
vishal8909
Fontconfig error: Cannot load default config file
SixBeeps
Try making an explicit config file:
1.) Make a folder called fonts
2.) Put the font you want to use in that folder
3.) Make a file in the folder named fonts.conf
and put this in it:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <dir>/var/task/fonts/</dir> <cachedir>/tmp/fonts-cache/</cachedir> <config></config> </fontconfig>
Bookie0
i dont know how to help you, but for others who can help you, you should include your repl or a link to it.
Hello! You are in luck! Here is the solution:
First, install a font. I usually use Google Fonts
Second, install as a zip. Unzip it and drag in the font(s) of your choice.
Third, add this line of code at the top of the file:
Now, you can use the font like:
Hope this helps! Be sure to mark as correct answer!
@Coder100 why dont work for me?
This is my code:
so your font is
fonts/ARIAL.TTF
? it should befonts/arial.ttf
@CrisKop@Coder100 no, but when i use
const { registerFont } = require('canvas');
all command dont workhmm?
@CrisKop
@Coder100 and no error in the console
@Coder100, Thanks for this! I've been using this for a bit now, but it seems like foreign characters/symbols from usernames aren't exactly working with the Roboto font. Any suggestions on that?