Cannot add text to Node.js canvas
I'm trying to make a captcha system, and right now experimenting with creating a canvas with text on it.
However, when I try to do that, the image file is created, but the text is not visible, and the console shows "Fontconfig error: Cannot load default config file".
I tried searching for it, and I found an answer here: https://askubuntu.com/questions/492033/fontconfig-error-cannot-load-default-config-file.
But that answer involved editing a file that is not accessible from Repl.it.
Does anyone know how to fix this in any other way?
Thanks.
Voters
I have the same error, i'm working on a discord bot
me too
@chandlerpc
Hey, I solved the problem, the error is because repl.it don have files .ttf, you only download a .tff and upload to repl.it proyect, on the code you need to change the direction of your file for the new typography, now the console know the typography, sorry for my bad english.
@PROSmash
@chandlerpc Hey, I added the .ttf file to my project how do i change the direction of the file
this is my code
ctx.font = '35px sans-serif'
@GlitchyBrick you can use the
registerFont function,like this
registerFont('./Impact.ttf', { family: 'Impact' });
In the canvas this :
ctx.font = '28px Impact';