mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 16:44:23 +08:00
1 parent
ffb92b9f2d
commit
92785cea4f
2 files changed
+3
-3
No files matched your search
@@ -213,7 +213,7 @@ class NativeHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fonts() {
|
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) {
|
async start(onFiles, onError) {
|
||||||
|
|||||||
@@ -705,8 +705,8 @@ func (h *Host) readFonts() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, face := range faces {
|
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})
|
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 []string{face.FullName, face.Family, face.PostScriptName, strings.TrimSpace(face.Family + " " + face.Style)} {
|
for _, alias := range append([]string{face.FullName, face.Family, face.PostScriptName, strings.TrimSpace(face.Family + " " + face.Style)}, face.Names...) {
|
||||||
if alias != "" {
|
if alias != "" {
|
||||||
h.fontFiles[alias+".ttf"] = name + "\x00" + strconv.Itoa(face.Index)
|
h.fontFiles[alias+".ttf"] = name + "\x00" + strconv.Itoa(face.Index)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user