feat: support advanced font custom
This commit is contained in:
+84
-1
@@ -93,12 +93,95 @@ spec:
|
||||
value: truetype
|
||||
- label: OpenType
|
||||
value: opentype
|
||||
- $formkit: checkbox
|
||||
name: advanced
|
||||
label: 高级设置
|
||||
value: false
|
||||
help: "等同于直接写 css. 参考文档: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face)"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: weight
|
||||
label: 字重
|
||||
value: "400"
|
||||
- $formkit: select
|
||||
if: "$value.advanced === true"
|
||||
name: style
|
||||
label: 字体样式
|
||||
value: normal
|
||||
options:
|
||||
- label: Auto
|
||||
value: auto
|
||||
- label: Normal
|
||||
value: normal
|
||||
- label: Italic
|
||||
value: italic
|
||||
- label: Oblique
|
||||
value: oblique
|
||||
- label: Left
|
||||
value: left
|
||||
- label: Right
|
||||
value: right
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: unicode_range
|
||||
label: Unicode 范围
|
||||
value: ""
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: width
|
||||
label: 字体宽度
|
||||
value: "auto"
|
||||
- $formkit: select
|
||||
if: "$value.advanced === true"
|
||||
name: display
|
||||
label: 字体显示策略
|
||||
value: swap
|
||||
options:
|
||||
- label: Auto
|
||||
value: auto
|
||||
- label: Block
|
||||
value: block
|
||||
- label: Swap
|
||||
value: swap
|
||||
- label: Fallback
|
||||
value: fallback
|
||||
- label: Optional
|
||||
value: optional
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: feature_settings
|
||||
label: OpenType 特性
|
||||
value: "normal"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: variation_settings
|
||||
label: 可变字体轴
|
||||
value: "normal"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: size_adjust
|
||||
label: 字体尺寸调整
|
||||
value: "100%"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: ascent_override
|
||||
label: 上升高度覆盖
|
||||
value: "normal"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: descent_override
|
||||
label: 下降高度覆盖
|
||||
value: "normal"
|
||||
- $formkit: text
|
||||
if: "$value.advanced === true"
|
||||
name: line_gap_override
|
||||
label: 行间隙覆盖
|
||||
value: "normal"
|
||||
- $formkit: checkbox
|
||||
name: color_scheme_switcher_enable
|
||||
label: 启用访客配色切换
|
||||
value: false
|
||||
help: 开启后在页头显示配色选择下拉框
|
||||
|
||||
- $formkit: select
|
||||
name: default_scheme_mode
|
||||
label: 默认配色方案
|
||||
|
||||
+28
-3
@@ -158,9 +158,34 @@
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: "[(${font.name})]";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url("[(${font.file})]") format("[(${font.format})]");
|
||||
src: local("[(${font.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'})];
|
||||
[# th:if="${font.advanced && font.unicode_range != null && !#strings.isEmpty(font.unicode_range)}"]
|
||||
unicode-range: [(${font.unicode_range})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.width != null && !#strings.isEmpty(font.width)}"]
|
||||
font-width: [(${font.width})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.feature_settings != null && !#strings.isEmpty(font.feature_settings)}"]
|
||||
font-feature-settings: [(${font.feature_settings})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.variation_settings != null && !#strings.isEmpty(font.variation_settings)}"]
|
||||
font-variation-settings: [(${font.variation_settings})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.size_adjust != null && !#strings.isEmpty(font.size_adjust)}"]
|
||||
size-adjust: [(${font.size_adjust})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.ascent_override != null && !#strings.isEmpty(font.ascent_override)}"]
|
||||
ascent-override: [(${font.ascent_override})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.descent_override != null && !#strings.isEmpty(font.descent_override)}"]
|
||||
descent-override: [(${font.descent_override})];
|
||||
[/]
|
||||
[# th:if="${font.advanced && font.line_gap_override != null && !#strings.isEmpty(font.line_gap_override)}"]
|
||||
line-gap-override: [(${font.line_gap_override})];
|
||||
[/]
|
||||
}
|
||||
[/]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user