Open mirko-ll opened 1 year ago
same here. Were you able to handle it right way ?
@bvitlas This appears to be an issue with the newer versions of canvas. I've been tearing my hair out trying to figure out if it's an issue in my code.
Reverting to version 2.9.0 of canvas fixed the issue for me.
Posted some findings here: https://github.com/Automattic/node-canvas/issues/2097#issuecomment-1803950952
- It only happens when there is any custom font installed, either in
/usr/share/fonts
or in$HOME/.local/share/fonts
. If both of those directories are empty, thenregisterFont
works fine.- Installing the custom font into the OS instead of using
registerFont
makes it work. Having the custom font installed in the system but then also callingregisterFont
with the same font breaks it again.- It doesn't happen with
canvas@2.9.0
but any later version (tried2.9.1
and2.11.2
), so the assumption that it was caused by the changes of #1987 makes a lot of sense.
Issue with loading custom fonts using registerFont()
Note: I have tried multiple fonts so problem is not in font files... Keep getting this error below and output in fallback font...
(process:22832): Pango-WARNING **: 12:52:05.268: couldn't load font "Zen Dots Not-Rotated 40px", falling back to "Sans Not-Rotated 40px", expect ugly output.
Steps to Reproduce
Your Environment
npm list canvas
oryarn list canvas
): 2.11.2