Open
Conversation
新增功能: - 添加字体缓存机制,支持缓存清理和使用统计 - 实现系统字体检测和 FontFace API 的 local() 源加载 - 扩展中文字体替换映射,支持 40+ 种常见 OFD 中文字体 - 实现按需字体加载,优先使用系统字体,减少网络请求 重构内容: - 从预加载所有默认字体改为按需加载 - 移除 LiteOfd.parse() 中的 loadLocalDefaultFonts() 调用 - 优化字体加载优先级:系统字体 > 嵌入字体 > 标准字体 > 回退字体 - 提供字体缓存统计和管理接口 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
新增 setFontPreloadPath 和 getFontPreloadPath 方法,允许用户自定义字体文件的加载路径,提升部署灵活性。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
新增 setFontURLGenerator 函数,允许用户自定义字体文件的URL生成逻辑, 支持更灵活的字体资源部署方案(如CDN、自定义路径等)。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- 移除 docs/assets/fonts 和 public/assets/fonts 目录下的字体文件 - 新增统一的 fonts 目录存放所有字体文件 - 更新 index.html 中的字体路径引用 - 修改 vite.config.ts 中的字体输出路径配置 - 修改 webpack.config.cjs 添加 fonts 目录的复制规则 - 更新 src/liteofd/ofdFont.ts 中的默认字体预加载路径 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- 移除 index.html 中的 @font-face 内联样式定义 - 将字体预加载路径从 /fonts/ 调整为 /liteofd/assets/fonts/ - 注释 webpack 中字体文件的独立复制配置 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- 保留字体按需加载优化功能 - 合并 opentype 字体渲染支持 - 合并配置管理系统 - 合并 canvas 渲染优化 - 合并文本渲染器 - 合并路径渲染器 - 合并配置 UI - 更新字体映射表 - 合并 develop 分支的其他功能改进
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. 字体文件目录结构重组
变更内容
将字体文件从
docs/assets/移动到项目根目录fonts/,并删除public/assets/fonts/下的重复字体文件。受影响文件 (22个)
影响说明
2. HTML 内联样式移除
变更文件:
index.html移除了 18 行内联
@font-face定义,这些定义原用于在页面加载时预加载基础字体。删除内容:
影响说明
3. 新增字体路径配置 API
变更文件:
src/liteofd/ofdFont.ts新增了 5 个导出函数,提供字体路径的灵活配置能力:
3.1 字体预加载路径配置
功能: 设置和获取字体文件的基础路径
默认值:
/liteofd/assets/fonts/使用场景: 当字体文件部署在不同服务器或路径时,可通过此 API 动态配置
3.2 自定义字体 URL 生成器
功能: 允许用户自定义字体 URL 的生成逻辑
使用示例:
3.3 字体加载路径适配
修改了
loadStandardFont函数中的字体路径生成逻辑:影响说明
4. API 导出更新
变更文件:
src/index.ts新增以下导出项:
影响说明
5. 构建配置调整
变更文件:
vite.config.ts变更: 字体文件输出路径从
assets/fonts/改为fonts/变更文件:
webpack.config.cjs变更: 注释掉了
fonts目录的复制配置(实际通过构建工具处理)影响说明
fonts/目录