mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +08:00
1 parent
983a856736
commit
98d9effc8c
18 files changed
+672
-137
No files matched your search
@@ -396,6 +396,20 @@ export class FontManager {
|
||||
return `${name}.ttf`;
|
||||
}
|
||||
|
||||
localEntries(fonts = this.catalog) {
|
||||
const entries = new Map();
|
||||
const disabled = new Set(this.localFonts.filter(font => !font.enabled).map(font => font.name));
|
||||
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`];
|
||||
for (const name of names) {
|
||||
if (name && !entries.has(name)) entries.set(name, font);
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
canReadLocal() {
|
||||
return typeof window.queryLocalFonts === "function";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user