Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lojjic/typr

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lojjic/typr

TypeScript fork of https://github.com/photopea/Typr.js

  • 0.3.8-lojjic1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@lojjic/typr

NOTE: This is a temporary branch forked from fredli74/Typr.js for the sole purpose of NPM-publishing accumulated fixes/changes that have not yet been merged back into fredli74's repo, for use in troika-three-text. Don't rely on it - @fredli74/typr is the canonical version.

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));

Keywords

FAQs

Package last updated on 08 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc