Files
XplorePlane/XP.ReportEngine/Documents/FontFilesGuidance.md
T

35 lines
1.6 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.
# 字体方案说明 | Font Strategy
## 当前方案 | Current Approach
XP.ReportEngine 使用 **Windows 系统自带字体** 生成 PDF,无需额外下载或嵌入字体文件。
| 语言 | 字体 | 文件 | 说明 |
|------|------|------|------|
| 简体中文 / 繁体中文 | 微软雅黑 | `C:\Windows\Fonts\msyh.ttc` | Windows 10+ 自带,支持简繁体 |
| 西文(英文等) | Arial | `C:\Windows\Fonts\arial.ttf` | Windows 自带 |
## 为什么使用系统字体 | Why System Fonts
1. **Telerik RadPdfViewer 兼容性** — 系统字体生成的 PDF 在 Telerik RadPdfViewer 中显示正常,不会出现中文乱码
2. **无需额外部署** — 不需要随应用程序分发字体文件,减小安装包体积
3. **跨阅读器兼容** — 字体以子集嵌入 PDF 中(`PREFER_EMBEDDED`),在任何 PDF 阅读器中都能正确显示
## 后备机制 | Fallback Mechanism
ITextPdfRenderer 按以下顺序加载字体:
1. 微软雅黑(`msyh.ttc`)→ 加载失败时尝试宋体(`simsun.ttc`
2. Arial`arial.ttf`)→ 加载失败时使用 iText 内置 Helvetica
3. 最终后备:Helvetica(不支持中文字符)
## 系统要求 | System Requirements
- Windows 10 或更高版本(微软雅黑为系统预装字体)
- 如果在精简版 Windows 上运行,需确保系统已安装微软雅黑字体
## Fonts 目录 | Fonts Directory
`XP.ReportEngine/Fonts/` 目录当前为空,保留用于未来可能的自定义字体扩展。
如需添加自定义字体,可在 `ITextPdfRenderer.InitializeFonts()` 中扩展加载逻辑。