Automattic / Automattic/node-canvas

Some Chinese fonts are downgraded to default fonts after rendering

Open
#2,238 3 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

## Steps to Reproduce
```js
registerFont('./xx/HYYakuHei-EEW.ttf', { family: 'HYYakuHei-EEW' });

const canvas = createCanvas(100, 100);
const ctx = canvas.getContext('2d');
ctx.font = '20px HYYakuHei-EEW';
ctx.fillText('测试', 20, 50);
```
output
![out](https://user-images.githubusercontent.com/2820736/234834254-0f471cad-3fa3-422a-a901-6fda93d92f80.png)

However, everything is rendered correctly using the canvas API in Chrome browser, so it shouldn't be a font problem.
```html


const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");

ctx.font = "20px HYYakuHei-EEW";
ctx.fillText("测试", 20, 50);

```
output
![image](https://user-images.githubusercontent.com/2820736/235029802-f46571f2-f286-47bb-bb19-7cb7d681a6f1.png)

font name is from PostScript
![image](https://user-images.githubusercontent.com/2820736/234834859-2df71542-29fd-45d1-b182-350e40e2ea68.png)

## Your Environment
* Version of node-canvas (2.11.2):
* Environment ( node 14.20.0 on Mac OS X 12.4):

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.