Automattic / Automattic/node-canvas
Can't render Noto Sans CJK JP on Windows
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue or Feature
Noto Sans CJK JP will render on Ubuntu but not on Windows. On Windows, a Pango warning is displayed:
` Pango-WARNING **: 16:55:13.449: couldn't load font "Noto Sans CJK JP Not-Rotated 100px", falling back to "Sans Not-Rotated 100px", expect ugly output.`
Noto Sans CJK JP is the only font I have found with this issue. The other ~20 I've tried work fine on Windows.
## Steps to Reproduce
1. Download Noto Sans CJK JP: https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip
2. Extract NotoSansCJKjp-Regular.otf somewhere
3. In the same directory, `npm install canvas`
4. In the same directory, run the following code:
```js
const fs = require('fs');
const Canvas = require('canvas');
Canvas.registerFont(__dirname + '/NotoSansCJKjp-Regular.otf', { family: 'Noto Sans CJK JP' });
const canvas = Canvas.createCanvas(120, 120);
const ctx = canvas.getContext('2d');
ctx.font = `100px Noto Sans CJK JP`;
ctx.fillText('本', 10, 100);
canvas.toBuffer((err, buffer) => {
fs.writeFileSync(__dirname + '/output.png', buffer);
});
```
On Windows, the above code results in a Pango warning and the output does not use the correct font. On Ubuntu, there is no warning and the output is correct.
[Output from PANGO_WIN32_DEBUG=true](https://github.com/Automattic/node-canvas/files/5322314/debug_output.txt)
## Your Environment
* Version of node-canvas: 2.6.1
* Environment: Node v12.18.4 on Windows 10 and Node v12.18.4 on Ubuntu 18.04.4
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.