feat(原生桌面): 修复原生文字创建与字体识别
build.yaml / build (push) Successful in 43s

This commit is contained in:
xiaoqidun committed 2026-10-18 03:20:03 +08:00
1 parent ffb92b9f2d
commit 92785cea4f
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -213,7 +213,7 @@ class NativeHost {
}
async fonts() {
return (await this.call("fonts", {})).map(font => ({...font, nativeFile:new NativeFile(font.file)}));
return (await this.call("fonts", {})).map(({file, ...font}) => ({...font, nativeFile:new NativeFile(file)}));
}
async start(onFiles, onError) {
+2 -2
View File
@@ -705,8 +705,8 @@ func (h *Host) readFonts() {
continue
}
for _, face := range faces {
h.fonts = append(h.fonts, map[string]any{"index": face.Index, "postscriptName": face.PostScriptName, "fullName": face.FullName, "family": face.Family, "style": face.Style, "file": file})
for _, alias := range []string{face.FullName, face.Family, face.PostScriptName, strings.TrimSpace(face.Family + " " + face.Style)} {
h.fonts = append(h.fonts, map[string]any{"index": face.Index, "postscriptName": face.PostScriptName, "fullName": face.FullName, "family": face.Family, "style": face.Style, "names": face.Names, "file": file})
for _, alias := range append([]string{face.FullName, face.Family, face.PostScriptName, strings.TrimSpace(face.Family + " " + face.Style)}, face.Names...) {
if alias != "" {
h.fontFiles[alias+".ttf"] = name + "\x00" + strconv.Itoa(face.Index)
}