Automattic / Automattic/node-canvas

Pango-WARNING on every font I've tried (Windows 11)

Open
#2,077 4 comments 6 reactions 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

Hey everyone,

I'm trying to use Helvetica on Windows 11 and I'm getting the following error:
```
(process:29384): Pango-WARNING **: 10:51:41.517: couldn't load font "Helvetica Neue Heavy Not-Rotated 120px", falling back to "Sans Heavy Not-Rotated 120px", expect ugly output.
(process:29384): Pango-WARNING **: 10:51:41.529: couldn't load font "Helvetica Neue Heavy Not-Rotated 32px", falling back to "Sans Heavy Not-Rotated 32px", expect ugly output.
```
I've tried 4 different version of Helvetica now and I'm getting the same error on every single one. This is my code:
```js
registerFont('./fonts/HelveticaNeue-Heavy.otf', {
family: 'Helvetica Neue Heavy',
})

const canvas = createCanvas(1200, 630)
const context = canvas.getContext('2d')

/* DRAW GRADIENT */
const gradient = context.createLinearGradient(0, 0, 0, 630)
gradient.addColorStop(0, '#DBECDD')
gradient.addColorStop(1, '#E2D1F9')

context.fillStyle = gradient
context.fillRect(0, 0, 1200, 630)

/* DRAW FLOWER NAME */
const name = flower.name.split(' ')
context.font = '120px "Helvetica Neue Heavy"'
context.fillText(name[0], 60, 180)
context.fillText(name[1], 60, 300)

/* DRAW FLOWER DESCRIPTION */
context.font = '32px "Helvetica Neue Heavy"'
context.fillText(flower.description, 60, 420)
```
I'm not entirely sure what I'm doing wrong. Any ideas?

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.