You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ createCanvas, registerFont }=require("canvas");constpath=require("path");constfs=require("fs");constfontPath=path.join(__dirname,"Fancy Thread DEMO 400.ttf");console.log(`Loading font from: ${fontPath}`);if(fs.existsSync(fontPath)){registerFont(fontPath,{family: "CustomFont"});console.log("Font registered successfully");}else{console.error("Font file does not exist");}constcanvas=createCanvas(800,600);constctx=canvas.getContext("2d");ctx.font='48px "CustomFont"';ctx.fillText("Hello, world!",50,100);constbuffer=canvas.toBuffer("image/png");fs.writeFileSync("output.png",buffer);console.log("Image saved as output.png");
Your Environment
Environment (e.g. node 20.9.0 on win 11):
"canvas": "^2.11.2",
I getting this message error
(process:3048): Pango-WARNING **: 19:14:44.535: couldn't load font "Fancy Thread DEMO Not-Rotated 48px", falling back to "Sans Not-Rotated 48px", expect ugly output.
I can't load custom font
I tried in vps it worked the error only in windows
The text was updated successfully, but these errors were encountered:
Issue
Steps to Reproduce
Your Environment
I getting this message error
(process:3048): Pango-WARNING **: 19:14:44.535: couldn't load font "Fancy Thread DEMO Not-Rotated 48px", falling back to "Sans Not-Rotated 48px", expect ugly output.
I can't load custom font
I tried in vps it worked the error only in windows
The text was updated successfully, but these errors were encountered: