opentype.js
opentype.js copied to clipboard
TrueType Collection file. Error: Unsupported OpenType signature ttcf
I am trying to open font file with multiple styles inside.
Expected Behavior
font collection file is handled, opentype.js finds multiple fonts.
Current Behavior
Possible Solution
I have know idea to be honest :)
Steps to Reproduce (for bugs)
compile multiple ttf fonts into one file using this guide https://graphicdesign.stackexchange.com/a/104892/137343
Context
I want to get supported styles from font file
Your Environment
- Version used: web preview
- Font used: roboto from google fonts
- Browser Name and version: latest stable firefox and chrome
- Operating System and version (desktop or mobile): mac, ubuntu 19.04
- Link to your project:
https://mega.nz/#!OINDmA7I!KiPqAMqfXSp-QBLzUWjcsbasr4vjS8pObOnE9oqjdZw the file I was using
https://www.npmjs.com/package/fontkit#font-collection-objects found this.
@punksta Indeed this is not yet supported and if anybody wants to contribute my guess is that this could be helpful:
- Adding a postscriptName to the open method https://github.com/foliojs/fontkit/blob/436bd5e939e69dcf1e62ccb384cd8b7d07d263de/src/base.js#L19
- Iterating on the collection to find one that matches the postscriptName https://github.com/foliojs/fontkit/blob/e2ff84e69f83272a0f05179d537a86a462aea299/src/TrueTypeCollection.js#L34
- Tests: https://github.com/foliojs/fontkit/blob/e2ff84e69f83272a0f05179d537a86a462aea299/test/index.js#L59
The current workaround would be to find a .ttf, .otf or woff version of your font, or to unpackage the font collection to get all the .ttf
I ended up using fontkit. It does not support getting ttf files from font collection, but it can return list of font with names and other data. This is exactly that I needed.