npm

Need private packages and team management tools?Check out npm Orgs. »

fontjs

1.0.2 • Public • Published

Font.js (FontJS)

Font.js (FontJS) is library helping parse/encode and manipulate TrueType font files. In a future there is a plan to extend support to OpenType fonts as well.

Supported TrueType Tables

  • cmap
  • cvt
  • fpgm
  • glyf
  • hdmx
  • head
  • hhea
  • hmtx
  • loca
  • maxp
  • name
  • OS/2
  • post
  • prep

Example

import * as fontjs from "fontjs";
import { SeqStream, ByteStream } from "bytestream";
 
async function fontTest()
{
    const fontFetchResult = await fetch("./fonts/times.ttf");
    const fontFetchBuffer = await fontFetchResult.arrayBuffer();
    
    const font = fontjs.Font.fromStream(new SeqStream({ stream: new ByteStream({ buffer: fontFetchBuffer }) }));
    
    const fontStream = new SeqStream();
    
    const toStreamResult = font.toStream(fontStream);
}

Keywords

install

npm i fontjs

Downloadsweekly downloads

7

version

1.0.2

license

BSD-3-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability