Files
leaudit-platform-frontend/public/fonts/source-han-sans/README.md
T
LiangShiyong 30e100ef3e feat: 1. 本地化思源黑体的字体包并优先使用。
2. 添加权限映射表和全局查看权限的hook,便于路由控制不同权限按钮显示/隐藏。
3. 删除评查点分组的部分旧api方法。
4. 对接评查点分组接口,文档类型接口, 提示词管理接口, 入口模块管理的接口。
5. 优化角色权限管理的接口,完善不用地区的访问权限认证。
6. 优化主页交叉评查和设置的入口样式和布局。
7. 优化评查点分组,评查规则的功能权限校验。
2025-11-29 10:37:35 +08:00

144 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 思源黑体(Source Han Sans SC)字体文件
本目录存放思源黑体的字体文件,用于本地化部署。
## 📥 下载字体文件
### 方法 1:从 GitHub 直接下载(推荐)
访问官方 GitHub 仓库:
https://github.com/adobe-fonts/source-han-sans/tree/release
**步骤**
1. 进入 `SubsetOTF/SC/` 目录
2. 下载以下文件(点击文件名 → 点击 "Download" 按钮):
- `SourceHanSansSC-Regular.otf` - https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Regular.otf
- `SourceHanSansSC-Medium.otf` - https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Medium.otf
- `SourceHanSansSC-Bold.otf` - https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Bold.otf
3. 下载后放置到本目录(`public/fonts/source-han-sans/`)。
**快捷命令**Windows PowerShell):
```powershell
# 创建目录
New-Item -ItemType Directory -Force -Path "public/fonts/source-han-sans"
# 下载字体文件
$baseUrl = "https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC"
Invoke-WebRequest -Uri "$baseUrl/SourceHanSansSC-Regular.otf" -OutFile "public/fonts/source-han-sans/SourceHanSansSC-Regular.otf"
Invoke-WebRequest -Uri "$baseUrl/SourceHanSansSC-Medium.otf" -OutFile "public/fonts/source-han-sans/SourceHanSansSC-Medium.otf"
Invoke-WebRequest -Uri "$baseUrl/SourceHanSansSC-Bold.otf" -OutFile "public/fonts/source-han-sans/SourceHanSansSC-Bold.otf"
```
**快捷命令**macOS/Linux):
```bash
# 创建目录
mkdir -p public/fonts/source-han-sans
# 下载字体文件
cd public/fonts/source-han-sans
curl -LO "https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Regular.otf"
curl -LO "https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Medium.otf"
curl -LO "https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC/SourceHanSansSC-Bold.otf"
cd ../../..
```
### 方法 2:从 Google Fonts 下载
访问 Google Fonts 下载 Noto Sans SC(与思源黑体相同):
https://fonts.google.com/noto/specimen/Noto+Sans+SC
选择需要的字重后点击 "Download family" 下载。
### 方法 3:使用自动下载脚本
在项目根目录执行:
```powershell
# Windows PowerShell
.\scripts\download-fonts.ps1
```
脚本会自动从 GitHub 下载字体文件到正确的位置。
## 🔄 字体格式转换(可选,优化性能)
为了更好的 Web 性能,建议将 OTF 转换为 WOFF2 格式(压缩率更高)。
### 使用在线工具转换
1. **CloudConvert**(推荐)
- 访问:https://cloudconvert.com/otf-to-woff2
- 上传 OTF 文件
- 选择输出格式为 WOFF2
- 下载转换后的文件
2. **Font Squirrel**
- 访问:https://www.fontsquirrel.com/tools/webfont-generator
- 上传 OTF 文件
- 选择 "Optimal" 模式
- 下载 webfont kit
### 使用命令行工具转换
安装 `fonttools`Python 工具):
```bash
# 安装 fonttools
pip install fonttools brotli
# 转换 OTF 到 WOFF2
pyftsubset SourceHanSansSC-Regular.otf \
--output-file=SourceHanSansSC-Regular.woff2 \
--flavor=woff2 \
--layout-features="*" \
--unicodes="*"
```
或使用 Node.js 工具 `ttf2woff2`
```bash
# 安装工具
npm install -g ttf2woff2
# 转换 OTF 到 WOFF2(需要先转为 TTF
# 1. OTF → TTF(使用 fontforge 或在线工具)
# 2. TTF → WOFF2
ttf2woff2 SourceHanSansSC-Regular.ttf SourceHanSansSC-Regular.woff2
```
## 📂 最终文件结构
完成后,本目录应包含以下文件:
```
public/fonts/source-han-sans/
├── README.md (本文件)
├── SourceHanSansSC-Regular.otf (或 .woff2)
├── SourceHanSansSC-Medium.otf (或 .woff2)
└── SourceHanSansSC-Bold.otf (或 .woff2)
```
## ⚡ 性能优化建议
1. **只包含需要的字重**:减少文件数量
2. **使用 WOFF2 格式**:比 OTF 小 30-50%
3. **字体子集化**(高级):只包含项目中用到的汉字
4. **启用 CDN 缓存**:设置长期缓存头
## 🔍 字体验证
完成配置后,在浏览器中:
1. 打开开发者工具(F12
2. 切换到 Network 标签
3. 刷新页面
4. 查看字体文件是否成功加载
5. 在 Elements 标签中检查 `font-family` 是否应用
## 📝 许可证
思源黑体使用 **SIL Open Font License 1.1** 许可证,可免费用于商业和个人项目。
详见:https://github.com/adobe-fonts/source-han-sans/blob/release/LICENSE.txt