@basenative/fonts

中文文档
3.0.0发布于 2026/10/31(Apache-2.0 AND OFL-1.1)ES Module零依赖构建来源已验证

Self-hosted web fonts for BaseNative — the BaseNative Sans, Serif and Mono families plus Inter, JetBrains Mono, Source Serif 4 and DM Serif Display as woff2, with a ready-made @font-face stylesheet

原始使用文档
文档目录5 节
  1. Install
  2. Quick Start
  3. Bundler usage
  4. Included Fonts
  5. License

@basenative/fonts

Self-hosted web fonts for BaseNative projects — Sans, Serif, and Mono variants

Part of the BaseNative ecosystem — a signal-based web runtime over native HTML.

Install

npm install @basenative/fonts

Quick Start

<!-- Link the pre-built @font-face stylesheet -->
<link rel="stylesheet" href="node_modules/@basenative/fonts/fonts.css">
/* Then use the font families in your CSS */
body {
  font-family: 'BaseNative', sans-serif;    /* Sans (weight 400, normal stretch) */
}

code {
  font-family: 'BaseNative', monospace;     /* Mono (weight 400, ultra-condensed stretch) */
}

blockquote {
  font-family: 'BaseNative', serif;         /* Serif (weight 400, expanded stretch) */
}

Bundler usage

// Import via your bundler (Vite, ESBuild, etc.)
import '@basenative/fonts/fonts.css';

Included Fonts

All fonts are in .woff2 format and use font-display: swap for fast initial paint.

FileFamilyNotes
BaseNative-Sans.woff2BaseNativeweight 400, normal stretch
BaseNative-Serif.woff2BaseNativeweight 400, expanded stretch
BaseNative-Mono.woff2BaseNativeweight 400, ultra-condensed stretch
inter-latin.woff2InterVariable, Latin subset
source-serif-4-latin-variable.woff2Source Serif 4Variable, Latin subset
jetbrains-mono-latin-variable.woff2JetBrains MonoVariable, Latin subset
dm-serif-display-latin.woff2DM Serif DisplayDisplay weight, Latin subset

License

The package code is Apache-2.0 (LICENSE). The font files in src/ are licensed under the SIL Open Font License 1.1; the license text and each upstream copyright notice are in OFL.txt. The BaseNative-* files are renamed copies of Inter, Source Serif 4 and JetBrains Mono and stay under the OFL.

版本与发布记录

@basenative/fonts 共发布 11 个版本,首次发布于 2026/10/18;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.0.0latest2026/10/312 天前
2.4.02026/10/268 天前
2.3.22026/10/2212 天前
2.3.12026/10/2212 天前
2.3.02026/10/2212 天前
2.2.02026/10/2113 天前

关于 @basenative/fonts 的常见问题

@basenative/fonts 是什么?

BaseNative的自托管web字体-BaseNative Sans,Serif和Mono系列以及Inter,JetBrains Mono,Source Serif 4和DM Serif显示为woff2,带有现成的 @ font-face样式表

如何安装 @basenative/fonts?

在项目目录运行 npm install @basenative/fonts,或使用 pnpm add / yarn add / bun add。

@basenative/fonts 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/basenative__fonts 是否存在。

@basenative/fonts 支持 ESM 还是 CommonJS?

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

@basenative/fonts 可以商用吗?

@basenative/fonts 使用 (Apache-2.0 AND OFL-1.1) 许可。声明的许可为 (Apache-2.0 AND OFL-1.1),请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@basenative/fonts 还在维护吗?

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