# @basenative/fonts 中文文档

规范地址：https://npmcn.com/package/%40basenative/fonts/

版本：3\.0\.0
npm 元数据更新时间：2026-10-31T13:47:18.809Z
中文译文更新时间：2026-10-31T16:16:25.941Z
软件包许可：\(Apache-2\.0 AND OFL-1\.1\)

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40basenative/fonts
原文对照：https://npmcn.com/package/%40basenative/fonts/?lang=original
项目主页：https://github.com/DuganLabs/BaseNative/tree/main/packages/fonts#readme
源码仓库：https://github.com/DuganLabs/BaseNative

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：533 kB，12 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2026-10-18T05:29:17.504Z
- 最新版本发布：2026-10-31T13:47:18.472Z
- 已发布版本数：11（近 12 个月 11 个）

## 中文简介

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

## 安装

```sh
npm install @basenative/fonts
```

也可以使用：`pnpm add @basenative/fonts`、`yarn add @basenative/fonts`、`bun add @basenative/fonts`

## README

# @basenative /字体

> 用于基础项目的自托管web字体-Sans、Serif和Mono变体

部分 [BaseNative](https://github.com/DuganLabs/basenative) 生态系统——基于信号的web运行时，基于原生HTML。

## 安装

```bash
npm install @basenative/fonts
```

## 快速入门

```html
<!-- Link the pre-built @font-face stylesheet -->
<link rel="stylesheet" href="node_modules/@basenative/fonts/fonts.css">
```

```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) */
}
```

## 打包机的使用

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

## 包含的字体

所有字体都在 `.woff2` 格式和使用 `font-display: swap` 用于快速初涂。

| 文件 | 家庭 | 笔记 |
| --- | --- | --- |
| `BaseNative-Sans.woff2` | `BaseNative` | 重量400，正常拉伸 |
| `BaseNative-Serif.woff2` | `BaseNative` | 重量400，扩展拉伸 |
| `BaseNative-Mono.woff2` | `BaseNative` | 重量400，超冷凝拉伸 |
| `inter-latin.woff2` | `Inter` | 变量，拉丁子集 |
| `source-serif-4-latin-variable.woff2` | `Source Serif 4` | 变量，拉丁子集 |
| `jetbrains-mono-latin-variable.woff2` | `JetBrains Mono` | 变量，拉丁子集 |
| `dm-serif-display-latin.woff2` | `DM Serif Display` | 显示权重，拉丁子集 |

## 许可证

包代码是Apache-2.0 (`LICENSE`）。中的字体文件 `src/` 遵循SIL开放字体许可证1.1；许可文本和每个上游版权声明都在 `OFL.txt`。这个 `BaseNative-*` 文件被重命名为Inter，Source Serif 4和JetBrains Mono的副本，并保留在OFL下。

## 常见问题

### @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 和提交记录判断。

