foliojs / fontkit

An advanced font engine for Node and the browser
1.45k stars 213 forks source link

how to get ttf file? #240

Open JonSnow-vn opened 3 years ago

JonSnow-vn commented 3 years ago

i try to extract .ttc file to .ttf file, but i just get ttf font object. So how can i get ttf file?

Pomax commented 3 years ago

First: note that this might be entirely illegal because most font collections that are packed as .ttc are paid fonts that do not permit extracting, only subset embedding (if even that).

With that said, why would you use Fontkit for this at all? Use a command line tool for that conversion, or something like FontForge.

alecjacobson commented 1 year ago

This is a reasonable feature request. The legality is a distraction (fontkit's glyph extraction/svg conversion could also be used to break copyrights). The feature has been requested a few times: https://github.com/foliojs/fontkit/issues/240 https://github.com/foliojs/fontkit/issues/156 https://github.com/foliojs/fontkit/issues/81

I ran into wanting/needing this when trying to compare the browser's rendering of a selected font to the extracted glyphs. For ttfs, it's easy to point the webpage's CSS to the url. For ttc, if fontkit provided a way to extract out the relevant buffer then this could also be done with a blob.

PratikDarak commented 7 months ago

This is a reasonable feature request. The legality is a distraction (fontkit's glyph extraction/svg conversion could also be used to break copyrights). The feature has been requested a few times: #240 #156 #81

I ran into wanting/needing this when trying to compare the browser's rendering of a selected font to the extracted glyphs. For ttfs, it's easy to point the webpage's CSS to the url. For ttc, if fontkit provided a way to extract out the relevant buffer then this could also be done with a blob.

+1 to this suggestion. We have a few open-source fonts that are part of a collection and we need a way to extract them to their individual font files. It would be really helpful if fontkit provided a way to do this.