Feature/font load #12
Open
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/目录