Automattic / Automattic/node-canvas
FontRegister not working on Ubuntu 23.10
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue or Feature
I'm trying to use the function fontRegister in my code, but the font is never loaded.
I don't get any error message, but I can't use the font after import.
However, the exact same code on Ubuntu 20.04 or Debian 12 works fine.
Below is the result for Ubuntu 20.04 (top) and Ubuntu 23.10 (bottom)

## Steps to Reproduce
Here is a simple code to reproduce the issue, I took a monospace font from the default ones in Ubuntu (/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf), and put it in the same folder as this code.
I can reproduce the issue by running this code on any of the Ubuntu 23.10 I have.
```
import { createCanvas, loadImage, registerFont } from "canvas";
import fs from "fs/promises";
registerFont("DejaVuSansMono.ttf", {
family: "Comic Sans MS"
});
(async () => {
const img = await createCanvas(1000, 300);
const img_ctx = img.getContext('2d');
img_ctx.fillStyle = "#2b2d31";
img_ctx.fillRect(0, 0, 1000, 300);
img_ctx.fillStyle = "white";
img_ctx.font = '50px "Comic Sans MS"';
img_ctx.fillText("Test text", 320, 180);
await fs.writeFile("test_image.png", img.toBuffer("image/png"));
})();
```
## Your Environment
* Version of node-canvas : 2.11.2
* Environment : node 21.5.0 on Ubuntu 23.10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.