update at 2026-02-06 16:18:57
This commit is contained in:
14
PLAN.md
14
PLAN.md
@@ -263,6 +263,20 @@ export async function loadFontWithProgress(
|
||||
```
|
||||
|
||||
#### 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
|
||||
// src/composables/useSvgGenerate.ts
|
||||
import { ref } from 'vue';
|
||||
|
||||
Reference in New Issue
Block a user