A Size Limited and TypeScript Friendly Font Collection for Serverless Environment. Including 1300+ Google Fonts!
The unpacked size (~66 MB) includes all 1,300+ fonts in 3 formats. (ESM: ~30 MB, CJS: ~30 MB, DTS: ~6 MB)
The average size of each font is about 22 KB.
During the development of LeetCode Stats Card, a dynamic SVG image generator powered by Cloudflare Workers, I wanted to use fonts that were available on Google Fonts to display the texts.
Then I faced two problems:
Then, I thought if there is a collection to let me directly embed fonts in such an environment, things will be easier.
import Baloo_2 from "nano-font/fonts/Baloo_2";
// const Baloo_2 = require("nano-font/fonts/Baloo_2");
const my_css = `
font-face {
font-family: "${Baloo_2.name}";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("${Baloo_2.base64}") format("woff2");
}`;
1300+ Fonts from Google Fonts.
nano-font Documentation (including supported font list)
Generated using TypeDoc