ttf to json conversion

Martin Wenzel
Posts: 53
Hi, can anyone suggest a ttf to json converter? I've never even heard before that a json can be made from a ttf. The client wants to use it for “360° graphics”. Does that ring a bell?
I have found a converter online that seems to be popular (like https://gero3.github.io/facetype.js/) but wouldn't mind a 2nd opinion.
0
Comments
-
The "json" font format is a Three.js idiosyncrasy. In their documentation it just says:
Font
Create a set of Shapes representing a font loaded in JSON format.
This is used internally by the FontLoader.So likely this is a json encoded svg representation of the glyphs in the font. It really isn't clear if the resulting "font" actually has metrics, features, kerning, etc. or if it is just the glyph geometry. The tool you linked above is also the only available "encoder" (another one seems to be defunct) so that is the way.Personally, I'd leave it up to the client and their developers implementing the Three.js animations to convert the font so as to avoid personal liability for the output and quality of the converter.2 -
Hi @Johannes Neumeier, thanks for your insight. Much appreciated.
0 -
I just found that ThreeJS also seems to support ttf:
0 -
Note that the FontLoader they supply relies on Opentype.js, which in turn will be a large dependency library to include and load for the end user. Potentially it still makes sense to use the json encoding to save that download time. Either way, it might also be a useful optimization to subset the font (with either encoding/loading strategy) to the bare minimum needed for the animation. Even for dynamic text it can probably be subset to save on load time.Also, if you have a look at what data the FontLoader exposes it is clear that Three.js internally works only with the glyph outlines and basic vertical metrics, so no features, kerning or other niceties.Edit: In fact, if you look at the source code of the conversion tool, it also uses Opentype.js to expose, and then json-encode, the very same data - it just saves you from having to include Opentype.js as a dependency on your animation website.1
Categories
- All Categories
- 46 Introductions
- 3.8K Typeface Design
- 475 Type Design Critiques
- 555 Type Design Software
- 1.1K Type Design Technique & Theory
- 639 Type Business
- 829 Font Technology
- 29 Punchcutting
- 507 Typography
- 120 Type Education
- 313 Type History
- 74 Type Resources
- 109 Lettering and Calligraphy
- 30 Lettering Critiques
- 79 Lettering Technique & Theory
- 529 Announcements
- 84 Events
- 110 Job Postings
- 165 Type Releases
- 169 Miscellaneous News
- 274 About TypeDrawers
- 54 TypeDrawers Announcements
- 118 Suggestions and Bug Reports