feat(编辑能力): 修复字体编辑错配,优化来源标识
build.yaml / build (push) Successful in 37s

This commit is contained in:
xiaoqidun committed 2026-09-16 19:11:33 +08:00
1 parent 1914b5329a
commit f9646c70e9
8 files changed
+163 -68

No files matched your search

+9 -16
View File
@@ -410,23 +410,16 @@ func (e *Editor) editorFont(id string) (*font.SFNT, error) {
return sfnt, nil
}
if e.source != nil {
reader := e.source.reader
if f := reader.fontCache[id]; f != nil && f.FontFile != "" {
data, err := reader.ResData(f.FontFile)
if err != nil {
return nil, err
}
data, err = font.ToSFNT(data)
if err != nil {
return nil, err
}
sfnt, err := font.ParseSFNT(data, 0)
if err != nil {
return nil, err
}
e.fonts[id] = sfnt
return sfnt, nil
data, err := e.source.reader.FontData(id)
if err != nil {
return nil, err
}
sfnt, err := font.ParseSFNT(data, 0)
if err != nil {
return nil, err
}
e.fonts[id] = sfnt
return sfnt, nil
}
return nil, fmt.Errorf("embedded font %q not found", id)
}