You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
unknown
0073d80258
|
2 years ago | |
---|---|---|
.. | ||
bin | 2 years ago | |
csrc | 2 years ago | |
dist | 2 years ago | |
jssrc | 2 years ago | |
src | 2 years ago | |
CHANGELOG.md | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
binding.gyp | 2 years ago | |
builderror.log | 2 years ago | |
package.json | 2 years ago |
README.md
ttf2woff2
Convert TTF files to WOFF2 ones.
This is a NodeJS wrapper for the Google WOFF2 project. If the C++ wrapper compilation fail, it fallbacks to an Emscripten build.
Usage
CLI
Install ttf2woff2
globally, then:
cat font.ttf | ttf2woff2 > font.woff2
On Windows without cat
, use (in PowerShell):
Start-Process -NoNewWindow -Wait ttf2woff2.cmd -RedirectStandardInput font.ttf -RedirectStandardOutput font.woff2
# OR
start-process -nnw -wait ttf2woff2.cmd -rsi font.ttf -rso font.woff2
API
var fs = require('fs');
var ttf2woff2 = require('ttf2woff2');
var input = fs.readFileSync('font.ttf');
fs.writeFileSync('font.woff2', ttf2woff2(input));
Contributing
Feel free to push your code if you agree with publishing under the MIT license.