
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Extract useful information from font files
npm install fontace
import { fontace } from 'fontace';
fontace?fontace is a small library, which intends to extract data specifically to help generate CSS @font-face declarations based on font files.
fontace returns the following CSS-compatible values intended for use with font-family, font-style, unicode-range, and font-weight:
family: The font family name as stored in the font file, e.g. "Inter".style: The style of this font file, e.g. "normal" or "italic".unicodeRange: The range of Unicode code points this font file contains, e.g. "U+0-10FFFF".weight: The font weight(s) this file supports, which can be a range for variable fonts, e.g. "400" or "100 900".In addition it returns:
format: The font file format for use in format(), e.g."woff2" or "truetype".isVariable: true if the font file contains variable axes of some kind.unicodeRangeArray: An array of the Unicode code point ranges this font file contains, e.g. ["U+0-10FFFF"], equivalent to unicodeRange.split(', '). Useful if you need to iterate through the available ranges instead of inlining them directly in CSS.Pass a buffer containing font file data to fontace() and get useful information back.
Use file-system APIs to read a local font file and then pass it to fontace():
import { fontace } from 'fontace';
import fs from 'node:fs';
const fontBuffer = fs.readFileSync('./Inter.woff2');
const metadata = fontace(fontBuffer);
// { family: "Inter", format: 'woff2', style: "normal", weight: "400", isVariable: false, unicodeRange: "U+0, U+20-7E...", unicodeRangeArray: ["U+0", "U+20-7E", ...] }
Fetch a font file over the network and then pass it to fontace():
import { fontace } from 'fontace';
const response = await fetch('https://example.com/Inter-Variable.woff2');
const fontBuffer = Buffer.from(await response.arrayBuffer());
const metadata = fontace(fontBuffer);
// { family: "Inter", format: 'woff2', style: "normal", weight: "100 900", isVariable: true, unicodeRange: "U+0, U+20-7E...", unicodeRangeArray: ["U+0", "U+20-7E", ...] }
fontace data to create CSSconst { family, format, isVariable, style, unicodeRange, weight } = fontace(fontBuffer);
let src = `url(/MyFont.woff2) format('${format}')`;
if (isVariable) src += ' tech(variations)';
const fontFaceDeclaration = `@font-face {
font-family: ${family};
font-style: ${style};
font-weight: ${weight};
font-display: swap;
unicode-range: ${unicodeRange};
src: ${src};
}`;
fontace uses the fontkitten package to extract data from font files.
FAQs
Extract useful information from font files
The npm package fontace receives a total of 1,075,453 weekly downloads. As such, fontace popularity was classified as popular.
We found that fontace demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.