Munter / subfont

Command line tool to optimize your webfont loading. Aggressive subsetting based on your font use, self-hosting of Google fonts and preloading
MIT License
1.56k stars 29 forks source link

How to use subfont to generate new woff2 file with only specific Glyphs? (cherry picking) #163

Closed Jieiku closed 2 years ago

Jieiku commented 2 years ago

Is there a way to use subfont to grab only certain font glyphs, maybe by unicode value?

I am hoping to do it via command line on linux.

U+f100
U+f101
U+f104
U+f105
U+e801
U+e803
Jieiku commented 2 years ago

I just found something which uses this library: https://github.com/omacranger/fontawesome-subset/issues/16#issuecomment-1151744198

papandreou commented 2 years ago

Do you mean outside the context of a web page? Yeah, then one option is https://github.com/papandreou/subset-font, although it doesn't offer a CLI. It uses harfbuzz under the hood, which comes with a CLI tool called hb-subset that you can use.

Alternatively you can use pyftsubset from https://github.com/fonttools/fonttools

Jieiku commented 2 years ago

I just implemented this: https://github.com/Jieiku/fontsubset

it seems to be getting the job done.

Thank you very very much for these libraries!

Jieiku commented 2 years ago

Now I just need to figure out how to combine font files into a single font file.

Munter commented 2 years ago

Is there a possibility for you to change the name of that new tool? We've spent some time on promoting subfont in different settings already, and it would be impractical to have another tool have exactly the same name and come out in searches instead

Jieiku commented 2 years ago

absolutely, will do it within the hour (not at my pc yet)

Munter commented 2 years ago

Thanks 😄