feat(字体渲染): 修复字体引用与渲染
build.yaml / build (push) Successful in 50s

This commit is contained in:
xiaoqidun committed 2026-10-10 15:52:36 +08:00
1 parent 04058ce76a
commit a5f51294eb
9 files changed
+50 -13

No files matched your search

+7 -1
View File
@@ -179,13 +179,16 @@ func (e *Editor) ObjectCapabilities(page int, id string) (ObjectCapabilities, er
// 入参: id 字体资源标识
// 返回: []byte 独立字体数据, error 错误信息
func (e *Editor) FontData(id string) ([]byte, error) {
if key := editorResourceID(id); key != "" {
id = key
}
for _, resource := range e.resources {
if resource.font != nil && resource.font.ID == id && len(resource.data) != 0 {
return bytes.Clone(resource.data), nil
}
}
if e.source != nil {
if definition := e.source.reader.fontCache[id]; definition != nil && definition.FontFile != "" {
if definition := e.source.reader.fontDefinition(id); definition != nil && definition.FontFile != "" {
return e.source.reader.FontData(id)
}
}
@@ -799,6 +802,9 @@ func editorGeometry(object GraphicObject) (string, string) {
// 入参: id 字体资源标识
// 返回: FontMetrics 字体度量, error 错误信息
func (e *Editor) editorFont(id string) (FontMetrics, error) {
if key := editorResourceID(id); key != "" {
id = key
}
if metrics := e.fontMetrics[id]; metrics != nil {
return metrics, nil
}