Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.14k stars 1.17k forks source link

text turn to boxes #1780

Open Noobslayer123 opened 3 years ago

Noobslayer123 commented 3 years ago

hi, i made a discord leveling system for my community. i made a text label on my canvas and it say 'cannot load default config file'

ctx.font = applyText(canvas, lvl, 32, 170, "Bold");
ctx.fillStyle = '#ffffff';
ctx.fillText(`level: ${lvl}

how can i fix this?

zbjornson commented 3 years ago

That's a Fontconfig error. I think the options are either setting the FONTCONFIG_PATH to the directory containing fonts, or using registerFont(). (See also e.g. https://stackoverflow.com/questions/41790659/fontconfig-error-cannot-load-default-config-file-on-ubuntu-16-04, https://askubuntu.com/questions/492033/fontconfig-error-cannot-load-default-config-file.)

arionukshini commented 3 years ago

i tryed using the registerFont() and still got the same error but how do i set the fontconfig path using FONTCONFIG_PATH

kykrueger commented 2 years ago

I had to install fontconfig as a dependency manually when using node-canvas as a part of a project based on a miniconda3 docker image which was built on debian. apt install fontconfig