update at 2026-02-06 16:18:57

This commit is contained in:
douboer
2026-02-06 16:18:57 +08:00
parent 104c435884
commit a1c70fd3f0

14
PLAN.md
View File

@@ -263,6 +263,20 @@ export async function loadFontWithProgress(
``` ```
#### 2.3 SVG 生成核心逻辑 #### 2.3 SVG 生成核心逻辑
**⚠️ 关键实现:参考 `font2svg.py` 用 TypeScript 重写**
这个模块是核心转换逻辑,完全对应 `font2svg.py` 的算法流程:
| Python 实现 | TypeScript 等价实现 |
|------------|-------------------|
| `TTFont(font_path)` | `opentype.parse(buffer)` |
| `hb.shape()` | `harfbuzz.js WASM shapeText()` |
| `font.getGlyphSet()[gid]` | `font.glyphs.get(glyphIndex)` |
| `glyph.draw(pen)` | `glyph.getPath().toPathData()` |
| 坐标变换26.6 定点数) | `item.xAdvance / 64` |
| SVG 模板拼接 | 字符串拼接 |
```typescript ```typescript
// src/composables/useSvgGenerate.ts // src/composables/useSvgGenerate.ts
import { ref } from 'vue'; import { ref } from 'vue';