mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
feat(原生桌面): 完善字体别名与集合匹配
This commit is contained in:
1 parent
92785cea4f
commit
a4f979ed2f
2 files changed
+2
-2
No files matched your search
@@ -400,7 +400,7 @@ export class FontManager {
|
||||
for (const font of fonts) {
|
||||
if (disabled.has(this.localName(font))) continue;
|
||||
const names = [this.localName(font), font.postscriptName && `${font.postscriptName}.ttf`,
|
||||
font.family && `${[font.family, font.style].filter(Boolean).join(" ")}.ttf`];
|
||||
font.family && `${[font.family, font.style].filter(Boolean).join(" ")}.ttf`, ...(font.names || []).map(name => `${name}.ttf`)];
|
||||
for (const name of names) {
|
||||
if (name && !entries.has(name)) entries.set(name, font);
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ func (h *Host) readFonts() {
|
||||
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, "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 != "" {
|
||||
if alias != "" && h.fontFiles[alias+".ttf"] == "" {
|
||||
h.fontFiles[alias+".ttf"] = name + "\x00" + strconv.Itoa(face.Index)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user