diff --git a/assets/webui/ofdgo_host.js b/assets/webui/ofdgo_host.js index cb30bfa..e0bd0aa 100644 --- a/assets/webui/ofdgo_host.js +++ b/assets/webui/ofdgo_host.js @@ -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) { diff --git a/internal/webview/webview.go b/internal/webview/webview.go index 82cfbdd..fc45a58 100644 --- a/internal/webview/webview.go +++ b/internal/webview/webview.go @@ -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) }