
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Register new font-face for the current web page by URL or from ArrayBuffer.
const addFont = require('add-font');
//CSS URL inserts the <link> to head
addFont('//cdn.jsdelivr.net/font-hack/2.020/css/hack.min.css');
//Font URL w/o extension inserts eot, woff2, woff, ttf, svg and otf versions
addFont('//cdn.jsdelivr.net/font-hack/2.020/fonts/eot/latin/hack-regular-latin-webfont',
`font-family: Hack; font-weight: normal;`);
//Font URL with extension inserts only target font file
addFont('./wavefont.otf', 'wavefont');
//ArrayBuffer will insert raw data as a font
addFont(myFont.toArrayBuffer(), `font-weight: bold; font-family: my-font-${id};`);
addFont(cssUrl)
addFont(fontUrl, cssString|fontName)
addFont(fontUrlList, cssString|fontName)
addFont(arrayBuffer, cssString|fontName)
Attach font to the page, apply additional parameters, which are whether font name or @font-face
properties, eg font-family: <x>; font-style: <y>; font-weight: <z>
.
The package is created for wavefont test.
It is here mostly to save arrayBuffer font code snippet.
It may be useful for font-related tests or in theory for font design tools.
For regular sites for css fonts just insert <link>
, for specific font use insert-styles
with @font-face
.
FAQs
Register font by url or as arrayBuffer
The npm package add-font receives a total of 16 weekly downloads. As such, add-font popularity was classified as not popular.
We found that add-font demonstrated a not healthy version release cadence and project activity because the last version was released 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.