#Canvas custom font not registering
47 messages · Page 1 of 1 (latest)
Project ID: 628e9bd7-1359-4b90-aa85-0c48855bd942
628e9bd7-1359-4b90-aa85-0c48855bd942
ctx.fillStyle = "white";
ctx.textAlign = "center";
ctx.font = "bold 18px Poppins";
ctx.fillText(shape.memberName, circleX, rectY + 80);
ctx.fillStyle = "#4e4e6a";
ctx.textAlign = "center";
ctx.font = "semi 12px Poppins";
ctx.fillText(shape.memberUsername, circleX, rectY + 95);
ctx.fillStyle = "#676786";
ctx.textAlign = "center";
ctx.font = "semi 14px Poppins";
ctx.fillText(
Math.floor(shape.voiceTimeMs / 60000) + " minutes",
circleX,
canvasHeight - 20
);```
it's likely that your path is just incorrect
@exotic goblet 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
@stoic escarp - are you providing this font in your repo?
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?
npm names are confusing
this would still count as node-canvas
This is why I don’t use node
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 on
no one is familiar with npm packages
Fair
im working on a test, will get back to you!
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
wait... i will check it
The register was no err but while generating image i got ```(process:22020): Pango-WARNING **: 20:36:57.742: couldn't load font "Poppins Bold Not-Rotated 28px", falling back to "Sans Bold Not-Rotated 28px", expect ugly output.
(process:22020): Pango-WARNING **: 20:36:58.349: couldn't load font "Poppins Bold Not-Rotated 18px", falling back to "Sans Bold Not-Rotated 18px", expect ugly output.
(process:22020): Pango-WARNING **: 20:36:58.354: couldn't load font "Poppins Bold Not-Rotated 12px", falling back to "Sans Bold Not-Rotated 12px", expect ugly output.
(process:22020): Pango-WARNING **: 20:36:58.363: couldn't load font "Poppins Bold Not-Rotated 14px", falling back to "Sans Bold Not-Rotated 14px", expect ugly output.```
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
Thank you for marking this question as solved!
Its working, thanks!