Automattic / Automattic/node-canvas
Exo 2 custom font isn't being applied
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue or Feature
I'm trying to load a custom font, Exo 2 to be precise, but the font doesn't apply, even after apparently being loaded successfully and registered.
The text is being rendered successfully however defaults to the default font. I've tested with other fonts e.g. Arial and it works with Arial, however I can't get it to work with Exo 2. Am I messing something up? Any help is highly appreciated!
Thanks in advance!
## Steps to Reproduce
```js
const Canvas = require('canvas');
Canvas.registerFont('fonts/EXO2-REGULAR.TTF', { family: 'Exo 2 Regular', weight: '400'});
Canvas.registerFont('fonts/EXO2-EXTRALIGHT.TTF', { family: 'Exo 2 Extra Light', weight: '200'});
const canvas = Canvas.createCanvas(400, 170);
const ctx = canvas.getContext('2d');
// Background Fill
ctx.fillStyle = '#2d2d37';
ctx.fillRect(0, 0, 400, 170);
// Text
ctx.font = '16px "Exo 2 Regular"';
ctx.fillStyle = '#FFFFFF';
ctx.fillText(message.author.username, 136, 95);
```
## Your Environment
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`):
```
├── canvas@2.0.0-alpha.17
└─┬ color-thief@2.2.3
└── canvas@1.6.13
```
* Environment (e.g. node 4.2.0 on Mac OS X 10.8):
Node.js 8.11.4 on Ubuntu Server 18.04 LTS
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.