common_word_font
v1.0.8
Published
font
Readme
common_word_font (常用字体库)
本项目提供一些常用的定制化中英文字体,支持通过 NPM 发布后经由 unpkg CDN 全局引入,也可直接下载到本地项目中使用。
已包含字体
1. 阿里巴巴普惠体 2.0 (Alibaba PuHuiTi 2.0)
- 包含字重: Thin (250), Light (300), Regular (400), Medium (500), SemiBold (600), Bold (700), ExtraBold (800), Heavy (900), Black (1000)
font-family:"Alibaba PuHuiTi 2.0"- CDN 引入路径:
//unpkg.com/common_word_font@latest/alibaba-puhuiti/stylesheetforall.css
2. D-DIN-PRO
- 包含字重: Regular (400), Medium (500), SemiBold (600), Bold (700), ExtraBold (800), Heavy (900)
font-family:"D-DIN-PRO"- CDN 引入路径:
//unpkg.com/common_word_font@latest/D-DIN-PRO-Font/stylesheetforall.css
3. 熊子杰行书 (Zijiefont)
- 包含字重: Normal
font-family:"Zijiefont"- CDN 引入路径:
//unpkg.com/common_word_font@latest/Zijiefont/stylesheetforall.css
如何使用
方式一:CDN 引入 (推荐)
本项目发布在 npm 后,可通过 unpkg 服务快速引入字体。
示例:在 HTML 中引入熊子杰行书
<link rel="stylesheet" href="//unpkg.com/common_word_font@latest/Zijiefont/stylesheetforall.css">示例:在 CSS 中引入并使用
/* 引入字体样式 */
@import url("//unpkg.com/common_word_font@latest/Zijiefont/stylesheetforall.css");
/* 应用字体 */
body {
font-family: "Zijiefont", sans-serif;
}方式二:本地引入
如果你想将字体文件直接下载到你的项目中使用,可以将对应的字体文件夹(如 Zijiefont)复制到你的项目静态资源目录中,然后引入该目录下的 stylesheet.css 文件即可:
示例:本地项目引入
/* 假设放在了 src/assets 目录下 */
@import url("./assets/Zijiefont/stylesheet.css");
body {
font-family: "Zijiefont", sans-serif;
}目录结构说明
每个字体文件夹内提供了两个样式表,以便在不同场景下使用:
stylesheet.css: 使用相对路径引用字体文件,适用于本地下载部署或打包项目。stylesheetforall.css: 使用unpkgCDN 绝对路径引用字体文件,适用于线上直接调用或无痛接入。
NPM 包信息
- 包名:
common_word_font - 版本:
1.0.6
