Skip to content

Commit 13584a1

Browse files
committed
feat: Add Fira Code font files and integrate into BaseHead and global styles
1 parent 5f15c63 commit 13584a1

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

public/fonts/FiraCode-Bold.ttf

185 KB
Binary file not shown.

public/fonts/FiraCode-Light.ttf

184 KB
Binary file not shown.

public/fonts/FiraCode-Medium.ttf

184 KB
Binary file not shown.

public/fonts/FiraCode-Regular.ttf

184 KB
Binary file not shown.

public/fonts/FiraCode-SemiBold.ttf

184 KB
Binary file not shown.

src/components/BaseHead.astro

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ interface Props {
1313
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
1414
const fontRegularUrl = 'https://blog.trustyai.org/fonts/atkinson-regular.woff';
1515
const fontBoldUrl = 'https://blog.trustyai.org/fonts/atkinson-bold.woff';
16+
const firaCodeRegularUrl = 'https://blog.trustyai.org/fonts/FiraCode-Regular.ttf';
17+
const firaCodeBoldUrl = 'https://blog.trustyai.org/fonts/FiraCode-Bold.ttf';
1618
1719
const { title, description, image = 'https://blog.trustyai.org/blog-placeholder-1.jpg' } = Astro.props;
1820
---
@@ -33,6 +35,8 @@ const { title, description, image = 'https://blog.trustyai.org/blog-placeholder-
3335
<!-- Font preloads -->
3436
<link rel="preload" href={fontRegularUrl} as="font" type="font/woff" crossorigin />
3537
<link rel="preload" href={fontBoldUrl} as="font" type="font/woff" crossorigin />
38+
<link rel="preload" href={firaCodeRegularUrl} as="font" type="font/ttf" crossorigin />
39+
<link rel="preload" href={firaCodeBoldUrl} as="font" type="font/ttf" crossorigin />
3640

3741
<!-- Font definitions -->
3842
<style set:html={`
@@ -50,6 +54,20 @@ const { title, description, image = 'https://blog.trustyai.org/blog-placeholder-
5054
font-style: normal;
5155
font-display: swap;
5256
}
57+
@font-face {
58+
font-family: 'Fira Code';
59+
src: url('${firaCodeRegularUrl}') format('truetype');
60+
font-weight: normal;
61+
font-style: normal;
62+
font-display: swap;
63+
}
64+
@font-face {
65+
font-family: 'Fira Code';
66+
src: url('${firaCodeBoldUrl}') format('truetype');
67+
font-weight: bold;
68+
font-style: normal;
69+
font-display: swap;
70+
}
5371
5472
/* Ensure the font is applied */
5573
body {

src/styles/global.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ code {
9595
padding: 2px 5px;
9696
background-color: rgb(var(--gray-light));
9797
border-radius: 2px;
98+
font-family: 'Fira Code', monospace;
9899
}
99100
pre {
100101
padding: 1.5em;
101102
border-radius: 8px;
102103
}
103104
pre > code {
104105
all: unset;
106+
font-family: 'Fira Code', monospace;
105107
}
106108
blockquote {
107109
border-left: 4px solid var(--accent);

0 commit comments

Comments
 (0)