mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-03 01:54:58 +08:00
feat: 存档界面接口
This commit is contained in:
1 parent
99432d4fd3
commit
da05785694
13 files changed
+86
-30
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user