Automattic / Automattic/node-canvas
Support for color (OpenType SVG) fonts
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
## Issue or Feature
It would be great to support colored fonts like these: https://www.colorfonts.wtf/. If these are used now, they just take on the fill color.
```
const fs = require('fs')
const { createCanvas, registerFont } = require('canvas')
const { buildResponse, handleError } = require('./utils')
registerFont('./fonts/gilbert-color.otf', { family: 'Gilbert Color' })
module.exports.canvasTest = async (event) => {
const canvas = createCanvas(200, 200)
const ctx = canvas.getContext('2d')
ctx.font = '12px "Gilbert Color"'
ctx.fillText('Awesome!', 50, 100)
const buf = canvas.toBuffer();
fs.writeFileSync("test.png", buf);
// return buildResponse('test.png')
}
```
Results in

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.