@hanzo/font

中文文档
1.9.6发布于 2026/10/30SIL OPEN FONT LICENSETypeScriptES Module零依赖近 30 天下载 1.6万

Zen — the Hanzo type family: sans, mono and pixel, with brand presets and a wasm cutter.

原始使用文档
文档目录4 节
  1. Installation
  2. Using with Next.js
  3. Arabic
  4. License

Zen, Zen Mono & Zen Pixel

Zen is the Hanzo type family, under the SIL Open Font License. Every copyright the licence requires is in LICENSE.txt, which ships beside the binaries.

Zen is a sans-serif typeface designed for legibility and simplicity. It is modern, geometric, and based on the principles of classic Swiss typography. It is designed to be used in body copy, headlines, logos, posters, and other large display sizes.

Zen Mono is a monospaced typeface, crafted to be the perfect partner to Zen. It is designed to be used in code editors, diagrams, terminals, and other text-based interfaces where code is rendered.

Zen Pixel is a display typeface family featuring five unique pixel-based variants, each with a distinct visual style. It is designed for decorative use in headlines, logos, and other display contexts where a pixelated aesthetic is desired.

Installation

pnpm add @hanzo/font

Using with Next.js

Zen is exported from @hanzo/font/sans, ZenMono can be found in @hanzo/font/mono, and Zen Pixel variants are available from @hanzo/font/pixel. All are NextFontWithVariable instances. You can learn more by reading the next/font docs.

Zen Pixel Variants

Zen Pixel includes five distinct variants, each exported separately:

ExportCSS VariableDescription
ZenPixelSquare--font-zen-pixel-squareSquare pixel shapes
ZenPixelGrid--font-zen-pixel-gridGrid-based pixel pattern
ZenPixelCircle--font-zen-pixel-circleCircular pixel shapes
ZenPixelTriangle--font-zen-pixel-triangleTriangular pixel shapes
ZenPixelLine--font-zen-pixel-lineLine-based pixel pattern
import {
  ZenPixelSquare,
  ZenPixelGrid,
  ZenPixelCircle,
  ZenPixelTriangle,
  ZenPixelLine,
} from "@hanzo/font/pixel";

App Router

In app/layout.js:

import { Zen } from "@hanzo/font/sans";

export default function RootLayout({ children }) {
  return (
    <html lang="en" className={Zen.className}>
      <body>{children}</body>
    </html>
  );
}

Pages Router

In pages/_app.js:

import { Zen } from "@hanzo/font/sans";

export default function MyApp({ Component, pageProps }) {
  return (
    <main className={Zen.className}>
      <Component {...pageProps} />
    </main>
  );
}

If you're using a version of Next.js that's older than 15, then in next.config.js or next.config.mjs add:

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
+  transpilePackages: ["@hanzo/font"],
};

export default nextConfig;

This is required to fix errors like:

  • TypeError: next_font_local__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function
  • SyntaxError: Cannot use import statement outside a module

With Tailwind CSS

All Zen fonts can be used through CSS variables.

  • Zen: --font-zen-sans
  • ZenMono: --font-zen-mono
  • ZenPixelSquare: --font-zen-pixel-square
  • ZenPixelGrid: --font-zen-pixel-grid
  • ZenPixelCircle: --font-zen-pixel-circle
  • ZenPixelTriangle: --font-zen-pixel-triangle
  • ZenPixelLine: --font-zen-pixel-line

In app/layout.js:

import { Zen } from "@hanzo/font/sans";
import { ZenMono } from "@hanzo/font/mono";
import { ZenPixelSquare } from "@hanzo/font/pixel";

export default function RootLayout({ children }) {
  return (
    <html
      lang="en"
      className={`${Zen.variable} ${ZenMono.variable} ${ZenPixelSquare.variable}`}
    >
      <body>{children}</body>
    </html>
  );
}
Tailwind CSS V4

Then in tailwind.css:

@theme {
  /* rest of your theme config */

  --font-sans: var(--font-zen-sans);
  --font-mono: var(--font-zen-mono);
  --font-pixel-square: var(--font-zen-pixel-square);
  --font-pixel-grid: var(--font-zen-pixel-grid);
  --font-pixel-circle: var(--font-zen-pixel-circle);
  --font-pixel-triangle: var(--font-zen-pixel-triangle);
  --font-pixel-line: var(--font-zen-pixel-line);

  /* rest of your theme config */
}
Tailwind CSS V3

Then in tailwind.config.js:

module.exports = {
  theme: {
    extend: {
      fontFamily: {
        sans: ["var(--font-zen-sans)"],
        mono: ["var(--font-zen-mono)"],
        "pixel-square": ["var(--font-zen-pixel-square)"],
        "pixel-grid": ["var(--font-zen-pixel-grid)"],
        "pixel-circle": ["var(--font-zen-pixel-circle)"],
        "pixel-triangle": ["var(--font-zen-pixel-triangle)"],
        "pixel-line": ["var(--font-zen-pixel-line)"],
      },
    },
  },
};

Arabic

Zen draws Latin and Cyrillic and no Arabic. @hanzo/font/css carries three Arabic companions, each declared with an Arabic unicode-range (U+0600–06FF, U+0750–077F, U+FB50–FDFF, U+FE70–FEFC), so a page with no Arabic on it never requests one:

FamilyFileswoff2
Noto Kufi Arabicfonts/arabic/NotoKufiArabic-Variable.woff2, wght 100–90094.7 KB
Noto Sans Arabicfonts/arabic/NotoSansArabic-Variable.woff2, wght 100–900132.5 KB
IBM Plex Sans Arabicfonts/arabic/IBMPlexSansArabic-<Weight>.woff2, 100–70070–75 KB a weight

The default (Noto Kufi Arabic, also var(--font-zen-arabic)) is declared under Zen and Zen Mono too, so font-family: Zen sets Arabic with no other change. To set Arabic in another companion, name it ahead of Zen: font-family: 'IBM Plex Sans Arabic', Zen, sans-serif.

Every companion draws every letter the Arabic-script languages Hanzo ships write (Arabic, Persian, Dari, Urdu, Pashto, Sindhi, Sorani Kurdish, Uyghur, Shahmukhi Punjabi); scripts/arabic.py refuses a face that does not. Cairo, Readex Pro and Rubik were measured and are not here: each misses letters Pashto, Sindhi, Kurdish or Uyghur write.

The Noto faces are cut to the Arabic blocks, variable over Zen's weight axis. IBM Plex Sans Arabic is IBM's own woff2, one file per weight, byte for byte: the OFL reserves the name "Plex", and a subset is a Modified Version that may not carry it. The default is a single variable file over 100–900 because faces in one family composite only when every descriptor but the range is equal, so Plex is offered under its own name only. None of them is ours: each keeps its own name and notice under the SIL Open Font License (fonts/arabic/OFL.txt for Noto, fonts/arabic/OFL-Plex.txt for Plex), and scripts/arabic.py rebuilds them from upstream pinned by commit and checksum. The next/font bindings carry Zen only.

License

The Zen font family is free and open sourced under the SIL Open Font License. The Arabic companions are the Noto Project's (dist/fonts/arabic/OFL.txt) and IBM's (dist/fonts/arabic/OFL-Plex.txt), under the same license.

版本与发布记录

@hanzo/font 共发布 22 个版本,首次发布于 2026/08/23;过去 12 个月发布了 22 个版本。

版本发布日期距今
1.9.6latest2026/10/3018 天前
1.9.52026/10/2325 天前
1.9.42026/10/2325 天前
1.9.32026/08/292 个月前
1.9.22026/08/292 个月前
1.9.12026/08/282 个月前

关于 @hanzo/font 的常见问题

@hanzo/font 是什么?

Zen — the Hanzo type family: sans, mono and pixel, with brand presets and a wasm cutter.

如何安装 @hanzo/font?

在项目目录运行 npm install @hanzo/font,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:next(>=13.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@hanzo/font 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@hanzo/font 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@hanzo/font 可以商用吗?

@hanzo/font 使用 SIL OPEN FONT LICENSE 许可。声明的许可为 SIL OPEN FONT LICENSE,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@hanzo/font 的下载量有多少?

根据 npm 官方下载统计,@hanzo/font 在 2026/10/17 – 2026/11/15 这 30 天内被下载 15,878 次,日均约 529 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@hanzo/font 还在维护吗?

最新版本 1.9.6 发布于 2026/10/30(18 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/08/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。