Automattic / Automattic/node-canvas

Fontconfig error: Cannot load default config file

Open
#2,166 1 comment 1 reaction 0 assignees View on GitHub
Binaries
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue
I want to use `Open Sans` font but when I try to do the registered my font it didnt register the font but this error appear:
`Fontconfig error: Cannot load default config file`
The font path is correct but why it doesn't not registered the font. Here is my ![screenshot](https://media.discordapp.net/attachments/898868491094982666/1045613978761580615/Screenshot_20221125-161612_Chrome.jpg)

## Steps to Reproduce
1. I check my font path is corrected and the font is downloaded to my system
2. I tried to do the [example/font.js](https://github.com/Automattic/node-canvas/blob/master/examples/font.js)
```js
const Canvas = require("canvas")
Canvas.registerFont('./font/OpenSans-Bold.tff', { family: 'Open Sans' , weight: 'bold' })

const canvas = Canvas.createCanvas(1020, 200)
const ctx = canvas.getContext("2d")

ctx.font = "43px Open Sans bold"
ctx.fillText("why me :(", 200, 102)
```

## Your Environment
* Version of node-canvas : `2.10.0`
* Environment : `node 19.1.0`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.