Automattic / Automattic/node-canvas
How to use a pre-defined family name in register_font.cc?
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
Context: Creating png images using custom fonts
Not super familiar with node-canvas's c++ side of things so I may be way off but it seems there is some sort of caching going on. I'm having an issue where some fonts within a family all render using the exact same font face (whichever font was registered first being the one that is used for all subsequent fonts). While digging, I found that these fonts have the same "preferred family name" and the same "style" properties within their meta info (using FontForge). Using FontForge to change the preferred family name, I was able to get these to work properly but thats not a solution for how we're using node-canvas.
https://github.com/Automattic/node-canvas/blob/d2d632402b7032fb0ff755be138d20b87766aff6/examples/font.js#L14
The above example hints that the family name and styles within the font's meta info will be used... Is there a way to override that behavior and provide pre-defined names instead of using whats provided inside the file itself?
I'm using register font like this:
```
registerFont(localFilepath, { family: options.localFontName })
```
env... canvas 2.6.0, node 12, OSX and FreeBSD
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.