Automattic / Automattic/node-canvas

Not able to load the Uni-Sans Font Family using Canvas

Open
#2,469 2 comments 1 reaction 0 assignees View on GitHub
Text & Fonts
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

Hello I am trying to load the Uni Sans Heavy Font using the node canvas but I am getting this warning again and again and hence not loading the font.

```
(process:20792): Pango-WARNING **: 19:43:22.791: couldn't load font "Uni Sans Heavy Not-Rotated 60px", falling back to "Sans Heavy Not-Rotated 60px", expect ugly output.

(process:20792): Pango-WARNING **: 19:43:22.827: couldn't load font "Uni Sans Heavy Not-Rotated 40px", falling back to "Sans Heavy Not-Rotated 40px", expect ugly output.

(process:20792): Pango-WARNING **: 19:43:22.840: couldn't load font "Uni Sans Heavy Not-Rotated 30px", falling back to "Sans Heavy Not-Rotated 30px", expect ugly output.
```

This is the code I am using

```
registerFont(
path.join(__dirname, "..", "..", "assets", "fonts", "Uni Sans Heavy.ttf"),
{ family: "Uni Sans Heavy" }
);

ctx.font = "bold 60px 'Uni Sans Heavy'";
```

How can I fix this issue? Please help me! Thanks

Canvas version: 2.10.2
Node.js version: 18
OS: Windows 11

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.