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

@foliojs-fork/fontkit

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foliojs-fork/fontkit

An advanced font engine for Node and the browser

  • 1.9.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
152K
decreased by-78.61%
Maintainers
1
Weekly downloads
 
Created

What is @foliojs-fork/fontkit?

@foliojs-fork/fontkit is a comprehensive library for working with fonts in Node.js and the browser. It allows you to load, parse, and manipulate font files, as well as render text to various outputs.

What are @foliojs-fork/fontkit's main functionalities?

Loading Fonts

This feature allows you to load font files synchronously. The code sample demonstrates how to load a font file and print its family name.

const fontkit = require('@foliojs-fork/fontkit');
const font = fontkit.openSync('path/to/font.ttf');
console.log(font.familyName);

Glyph Rendering

This feature allows you to render glyphs from a font. The code sample shows how to get a glyph for a specific code point and convert its path to SVG.

const fontkit = require('@foliojs-fork/fontkit');
const font = fontkit.openSync('path/to/font.ttf');
const glyph = font.glyphForCodePoint(65); // 'A'
console.log(glyph.path.toSVG());

Text Layout

This feature provides text layout capabilities. The code sample demonstrates how to layout a string of text and print the glyph IDs.

const fontkit = require('@foliojs-fork/fontkit');
const font = fontkit.openSync('path/to/font.ttf');
const run = font.layout('Hello, world!');
console.log(run.glyphs.map(g => g.id));

Font Subsetting

This feature allows you to create subsets of fonts. The code sample shows how to include a specific glyph in a subset and encode the subset font.

const fontkit = require('@foliojs-fork/fontkit');
const font = fontkit.openSync('path/to/font.ttf');
const subset = font.createSubset();
subset.includeGlyph(65); // 'A'
const subsetFont = subset.encode();
console.log(subsetFont);

Other packages similar to @foliojs-fork/fontkit

Keywords

FAQs

Package last updated on 07 Mar 2024

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