0.3.8 • Published 11 months ago

@fredli74/typr v0.3.8

Weekly downloads
16
License
MIT
Repository
github
Last release
11 months ago

Typr.ts

TypeScript class wrapper for photopea/Typr.js.

Design goal was to keep the core Typr.js fork in a separate branch as close to the original as possible to make eventual merging easier.

As of May 2020, the official photopea Typr.js project switched to using HarfBuzz and threw a lot of the font format parsing out. For that reason, my fork will have to continue it's own path.

I use this library in one of my own TypeScript projects and have only added class features that I needed.

  • Typr.parse(buffer) is done through the class constructor new typr.Font(buffer)
  • Typr.U functions are members of the class font.codeToGlyph(code)

Installation

npm install @fredli74/typr --save-dev

node load example

import * as fs from "fs";
import * as typr from '@fredli74/typr';

function toArrayBuffer(buf: Buffer) {
	let ab = new ArrayBuffer(buf.length);
	let view = new Uint8Array(ab);
	for (let i = 0; i < buf.length; ++i) {
		view[i] = buf[i];
	}
	return ab;
}
const data = fs.readFileSync("filename.ttf");
const font = new typr.Font(toArrayBuffer(data));
0.3.8

11 months ago

0.3.6

2 years ago

0.3.7

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

6 years ago