WordPress 5.8 版本以后引入了 theme.json 文件来控制主题的样式,这里记录一下一种添加个性化字体的方法。
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"appearanceTools": true,
"typography": {
"dropCap": false,
"fluid": true,
"fontFamilies": [
{
"fontFace": [
{
"fontDisplay": "block",
"fontFamily": "Sarasa Gothic Mono SC",
"fontStretch": "normal",
"fontStyle": "normal",
"fontWeight": "400",
"src": [
"file:./assets/fonts/Sarasa-Gothic/sarasa-mono-sc-regular.ttf"
]
}
],
"fontFamily": "'Sarasa Gothic Mono SC', monospace",
"name": "Sarasa Gothic Mono SC",
"slug": "sarasa-gothic-mono-sc"
}
]
},
"useRootPaddingAwareAlignments": true
}
}
发表回复