National Preventative Mechanism

    fontjs
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.1 • Public • Published

    Font.js (FontJS)

    Node.js CI Coverage Status npm version

    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.

    Example

    import * as fontjs from "fontjs";
    import { SeqStream, ByteStream } from "bytestreamjs";
    
    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);
    }

    Related

    Keywords

    Install

    npm i fontjs

    DownloadsWeekly Downloads

    52

    Version

    3.0.1

    License

    BSD-3-Clause

    Unpacked Size

    541 kB

    Total Files

    75

    Last publish

    Collaborators

    • peculiarventures
    • microshine