Shashank3736 / captcha-canvas

A captcha generator by using skia-canvas.
https://captcha-canvas.js.org
Apache License 2.0
61 stars 12 forks source link

Fontconfig error: Cannot load default config file #38

Closed Wizmoore closed 2 years ago

Wizmoore commented 2 years ago

hello iam using Replit and iam getting this error any idea how i can fix it

there is not Letters on the photo Preview https://imgur.com/Pedn0gd

Shashank3736 commented 2 years ago

Check issue #31 the problem is with skia-canvas, use v2 for now. v2.4.0 (#34) will have all the features of v3 in node-canvas.

Wizmoore commented 2 years ago

same problem after i use v2.4.0 https://prnt.sc/2461xlq how i can use external font using font path like this

      const { registerFont } = require('canvas')
       registerFont('./Structures/fonts/Genta.ttf', { family: 'Genta' })

this is my code

const captcha = new CaptchaGenerator()

          .setDimension(150, 450)
          .setCaptcha({font: "Genta", size: 60, color: "deeppink" })
          .setDecoy({ opacity: 0.5 })
          .setTrace({ color: "deeppink" });

        const captchaAttachment = captcha.generateSync(
          await captcha.png, 
          "captcha.png"
          );
        interaction.reply({ files: [captchaAttachment], content: `Code: ${captcha.text}` });
Shashank3736 commented 2 years ago

check version correctly. v2.4.0 is not yet released it's still a draft. BTW the way you use registerFont() is correct so the only issue is custom font do not support in your system.

Shashank3736 commented 2 years ago

Close because of inactivity I am going to assume that problem is resolved.