A simple command line tool for dumping a UTF-8 string of characters supported by a font file.
Unicode fonts are usually too large to be embedded as webfont: subsetting is necessary to get them into a reasonable size, especially for CJK fonts.
But which ones do you subset to ensure your design look consistent? There are 2 major approaches:
- Static subsetting: prepare a list common characters, subset them manually, and use such font only for certain elements on webpage.
I prefer the latter approach, because it's a lot easier to optimize and has less of an impact to performance.
But I wonder what characters they pick for their CJK subsets?
character-map to the rescue!
npm install character-map -g
TrueType, OpenType, WOFF v1 files are supported at the moment.
$ character-map -f my.ttf > map.txt
map.txt will contain a list of characters found in the font. Now you can use this result with a subsetting tool like fontmin.
$ fontmin -t `cat map.txt` other.ttf > subset.ttf
Of course you can verify the result with