feat: support PostScript names for fonts
This commit is contained in:
+7
-1
@@ -66,10 +66,16 @@ spec:
|
||||
label: "$value.file"
|
||||
children:
|
||||
- $formkit: text
|
||||
name: name
|
||||
name: family_name
|
||||
label: 字体名称
|
||||
placeholder: "JetBrains Mono"
|
||||
validation: "required:trim|length:1,64"
|
||||
- $formkit: text
|
||||
name: postscript_name
|
||||
label: PostScript Name
|
||||
placeholder: "JetBrainsMono-Regular"
|
||||
validation: "length:0,64"
|
||||
help: "用于匹配系统中已安装的本地字体"
|
||||
- $formkit: attachment
|
||||
name: file
|
||||
label: 自定义字体文件
|
||||
|
||||
@@ -155,8 +155,9 @@
|
||||
[# th:each="font : ${theme.config.style.custom_fonts}"]
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: "[(${font.name})]";
|
||||
src: local("[(${font.name})]"), url("[(${font.file})]") format("[(${font.format})]");
|
||||
font-family: "[(${font.family_name})]";
|
||||
src: local("[(${#strings.isEmpty(font.postscript_name) ? font.family_name : font.postscript_name})]"),
|
||||
url("[(${font.file})]") format("[(${font.format})]");
|
||||
font-style: [(${font.advanced ? #objects.nullSafe(font.style, 'normal') : 'normal'})];
|
||||
font-weight: [(${font.advanced ? #objects.nullSafe(font.weight, '400') : '400'})];
|
||||
font-display: [(${font.advanced ? #objects.nullSafe(font.display, 'swap') : 'swap'})];
|
||||
@@ -190,7 +191,7 @@
|
||||
:root {
|
||||
--family-theme-font:
|
||||
[# th:each="font, stat : ${theme.config.style.custom_fonts}"]
|
||||
"[(${font.name})]"[# th:if="${!stat.last}"],[/]
|
||||
"[(${font.family_name})]"[# th:if="${!stat.last}"],[/]
|
||||
[/];
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user