0.0.3 • Published 1 year ago

@refont/klippa v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

klippa

klippa is a high-performance font subset toolkit, powered by the Rust-based klippa project, and it binds to Node.js via napi-rs.

⚠️ Warning: This project is in the pre-release stage, and there may be some bugs.

Usage

import { subset } from '@refont/klippa';
import { readFileSync, writeFileSync } from "node:fs";

// Read the font file
const input = readFileSync("font.ttf");

// Create a subset of the font with the specified text
const output = subset(input, { text: "abc" });

console.log(output);
// => { contents: <Buffer 00 01 00 ...> }

// Write the subsetted font to a new file
writeFileSync("subset.ttf", output);

Roadmap

  • Subset font from text
  • Implement the kern table
  • Implement additional necessary SubsetFlags

Related

klippa : A Rust binary for subsetting a font file according to provided input.

napi-rs : A framework for building compiled Node.js add-ons in Rust via Node-API.

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago