Automattic / Automattic/node-canvas

registerFont() issue - not all fonts register

Open
#1,880 6 comments 0 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

## Issue or Feature
When registering several fonts in a row, only some of them work work.

## Steps to Reproduce
If I register my fonts as such:

```
var fontDir = ;
var fontFamily, fontFileTTF;

//register font COPPERPLATE LIGHT
fontFamily = "copperplate_light_IBF_50e340f8-4f7f-4071-b015-5b527db4e8be";
fontFileTTF = fontDir + "/" + fontFamily + ".ttf";
registerFont(fontFileTTF, { family: fontFamily , weight: 'normal', style: 'normal' });

//register font COPPERPLATE REGULAR
fontFamily = "copperplate_regular_IBF_50e340f8-4f7f-4071-b015-5b527db4e8be";
fontFileTTF = fontDir + "/" + fontFamily + ".ttf";
registerFont(fontFileTTF, { family: fontFamily , weight: 'normal', style: 'normal' });

//register font COPPERPLATE BOLD
fontFamily = "copperplate_bold_IBF_50e340f8-4f7f-4071-b015-5b527db4e8be";
fontFileTTF = fontDir + "/" + fontFamily + ".ttf";
registerFont(fontFileTTF, { family: fontFamily , weight: 'normal', style: 'normal' });
```
Only 2 of the 3 fonts display correctly.

The weird thing is, if I rearrange the order of registration, a different 2 of 3 display correctly.

So basically 1 always does not display, and it's always different given the ordering.

There are no errors and the fonts do exist as evidenced by the fact they do display if I comment out 2 of the 3.
Individually, they work as well.

## Your Environment
fabric@4.5.0
canvas@2.8.0
Ubuntu Release: 20.04

Any help troubleshooting would be greatly appreciated.
~ed

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.