feat: 存档界面接口

This commit is contained in:
AncTe committed 2025-06-10 12:04:04 +08:00
1 parent 99432d4fd3
commit da05785694
13 files changed
+86 -30

No files matched your search

+6 -2
View File
@@ -105,10 +105,12 @@ export class Font implements IFontConfig {
let unit = this.defaultSizeUnit;
let family = this.defaultFamily;
const tokens = str.split(/\s+/);
tokens.forEach(v => {
let lastIndex = 0;
tokens.forEach((v, i) => {
// font-italic
if (v === 'italic') {
italic = true;
lastIndex = i;
return;
}
@@ -116,6 +118,7 @@ export class Font implements IFontConfig {
const num = Number(v);
if (!isNaN(num)) {
weight = num;
lastIndex = i;
return;
}
@@ -124,10 +127,11 @@ export class Font implements IFontConfig {
if (!isNaN(parse)) {
size = parse;
unit = v.slice(parse.toString().length);
lastIndex = i;
return;
}
});
family = tokens.at(-1) ?? 'Verdana';
family = tokens.slice(lastIndex + 1).join(' ') ?? 'Verdana';
return new Font(family, size, unit, weight, italic);
}