Skip to content

timint/ttf2woff2

 
 

Repository files navigation

ttf2woff2

Convert TTF files to WOFF2 ones.

GitHub license

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

import { readFile, writeFile } from 'node:fs/promises';
import ttf2woff2 from 'ttf2woff2';

const input = await readFile('font.ttf');

await writeFile('font.woff2', ttf2woff2(input));

Contributing

Feel free to push your code if you agree with publishing under the MIT license.

Authors

License

MIT

About

Convert ttf files to woff2.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 51.1%
  • C++ 43.8%
  • JavaScript 2.4%
  • Makefile 1.3%
  • Python 1.2%
  • TypeScript 0.2%