Not able to load font node-canvas

2.4k Views Asked by At

I am trying to use Fira font but for some reason I am not able to do it.

registerFont('./fira.ttf', { family: 'Fira', weight: 700 });
ctx.font = '50px "Fira"';

This gives:

(process:14880): Pango-WARNING **: 20:25:33.039: couldn't load font "Fira Code Light Not-Rotated 50px", falling back to "Sans Light Not-Rotated 50px", 
expect ugly output.

(process:14880): Pango-WARNING **: 20:25:33.043: couldn't load font "Fira Code Light 50px", falling back to "Sans Light 50px", expect ugly output.

and with:

registerFont('./fira.ttf', { family: 'Fira', weight: 700 });
ctx.font = '50px';

I think it gives the right font but it's too small

1

There are 1 best solutions below

0
On

The font rendering, which is done with Pango, does not find the font you registered.

You should try to change the family name, probably to Fira Code. Please check out this issue for some details: https://github.com/Automattic/node-canvas/issues/1608