Skip to content

Commit 3af338f

Browse files
authored
fix: font type (#39)
1 parent 2807665 commit 3af338f

5 files changed

Lines changed: 12 additions & 7280 deletions

File tree

.vitepress/config.mts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -80,41 +80,6 @@ export default defineConfig({
8080
["meta", { property: "og:image:type", content: "image/png" }],
8181
],
8282

83-
transformHead: (cfg) => {
84-
const abcDiaBold = cfg.assets.find(() => /ABCDiatype-Bold\.\w+\.woff2/);
85-
const abcDiaLight = cfg.assets.find(() => /ABCDiatype-Light\.\w+\.woff2/);
86-
87-
if (abcDiaBold) {
88-
cfg.head.push(
89-
[
90-
'link',
91-
{
92-
rel: 'preload',
93-
href: abcDiaBold,
94-
as: 'font',
95-
type: 'font/woff2',
96-
crossorigin: ''
97-
}
98-
]
99-
);
100-
}
101-
102-
if (abcDiaLight) {
103-
cfg.head.push(
104-
[
105-
'link',
106-
{
107-
rel: 'preload',
108-
href: abcDiaLight,
109-
as: 'font',
110-
type: 'font/woff2',
111-
crossorigin: ''
112-
}
113-
]
114-
);
115-
}
116-
},
117-
11883
themeConfig: {
11984
// https://vitepress.dev/reference/default-theme-config
12085
nav: nav(),

.vitepress/theme/fonts.css

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
@font-face {
2-
font-family: 'ABC Diatype';
3-
font-weight: bold;
4-
src: url('/fonts/ABCDiatype-Bold.woff2') format("font-woff2");
5-
}
1+
@import '@fontsource-variable/geist/index.css';
62

7-
@font-face {
8-
font-family: 'ABC Diatype';
9-
src: url('/fonts/ABCDiatype-Light.woff2') format("font-woff2");
3+
:root {
4+
--vp-font-family-base: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
5+
--vp-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
106
}
117

12-
:root {
13-
--vp-font-family-base: 'ABC Diatype', ui-sans-serif, system-ui, sans-serif;
14-
/* normal text font */
15-
--vp-font-family-mono: 'ABC Diatype', monospace;
16-
/* code font */
8+
:where(h1, h2, h3, h4, h5, h6, .VPHero .name, .VPHero .text) {
9+
font-family: 'ABC Diatype', 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
1710
}

0 commit comments

Comments
 (0)