Skip to content

Commit 08908d4

Browse files
authored
Add Fira Code as monospaced font, misc typography improvements (#415)
1 parent 4343099 commit 08908d4

14 files changed

+97
-60
lines changed

custom/style.css

Lines changed: 49 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,86 @@
1-
/* Import Inter font */
2-
@import url('https://rsms.me/inter/inter.css');
1+
/* Import Fira Code font */
2+
@import "/fonts/fira_code.css"; /* Import Inter font */
3+
@import url("https://rsms.me/inter/inter.css");
34

45
html {
5-
font-family: 'Inter', sans-serif;
6+
font-family: "Inter", sans-serif;
67
}
78

89
@supports (font-variation-settings: normal) {
9-
html {
10-
font-family: 'Inter var', sans-serif;
11-
}
10+
html {
11+
font-family: "Inter var", sans-serif;
12+
}
1213
}
1314

14-
/* Import Fira Code font */
15-
@import url(https://cdn.jsdelivr.net/gh/tonsky/[email protected]/distr/fira_code.css);
16-
1715
@supports (font-variation-settings: normal) {
18-
code {
19-
font-family: 'Fira Code VF', monospace;
20-
}
16+
code {
17+
font-family: "Fira Code", monospace;
18+
}
2119
}
2220

2321
body {
24-
font-family: "Inter";
25-
/* Enable some font features for Inter (https://rsms.me/inter/#features/calt) */
26-
font-feature-settings: "ss01",
27-
/* Alternate (Open) digits */
28-
"ss02",
29-
/* Disambiguation gliphs */
30-
"case";
31-
/* Case alternates */
32-
letter-spacing: -0.005em;
33-
/* equals -0.5% */
22+
font-family: "Inter";
23+
/* Enable some font features for Inter (https://rsms.me/inter/#features/calt) */
24+
font-feature-settings: "ss01", /* Alternate (Open) digits */ "ss02",
25+
/* Disambiguation gliphs */ "case";
26+
/* Case alternates */
27+
letter-spacing: -0.005em;
28+
/* equals -0.5% */
3429
}
3530

3631
button {
37-
font-family: inherit;
32+
font-family: inherit;
3833
}
3934

4035
table {
41-
font-feature-settings: "tnum",
42-
/* Tabular numbers */
43-
"ss01",
44-
/* Alternate (Open) digits */
45-
"ss02",
46-
/* Disambiguation gliphs */
47-
"case";
48-
/* Case alternates */
36+
font-feature-settings: "tnum", /* Tabular numbers */ "ss01",
37+
/* Alternate (Open) digits */ "ss02", /* Disambiguation gliphs */ "case";
38+
/* Case alternates */
4939
}
5040

5141
code {
52-
/* "!important" needed because https://github.com/rust-lang/mdBook/issues/1552 */
53-
font-family: 'Fira Code', monospace !important;
54-
font-size: 0.85em;
42+
/* "!important" needed because https://github.com/rust-lang/mdBook/issues/1552 */
43+
font-family: "Fira Code", monospace !important;
44+
font-size: 0.85em;
45+
font-weight: 500;
5546
}
5647

57-
5848
.header {
59-
font-weight: 600;
49+
font-weight: 600;
6050
}
6151

6252
.menu-title {
63-
font-weight: 400;
64-
font-size: 2.75rem;
65-
letter-spacing: -0.02em;
66-
/* equals -2% */
53+
font-weight: 400;
54+
font-size: 2.75rem;
55+
letter-spacing: -0.02em;
56+
/* equals -2% */
6757
}
6858

6959
.box {
70-
margin: 20px 0;
71-
padding: 1.6px 20px;
72-
border-left-width: .75rem;
73-
border-left-style: solid;
60+
margin: 20px 0;
61+
padding: 1.6px 20px;
62+
border-left-width: 0.75rem;
63+
border-left-style: solid;
7464
}
7565

76-
.box>.box-title {
77-
font-weight: 600;
78-
text-transform: uppercase;
66+
.box > .box-title {
67+
font-weight: 600;
68+
text-transform: uppercase;
7969
}
8070

8171
.box.tip {
82-
border-color: #42b983;
83-
background-color: var(--quote-bg);
72+
border-color: #42b983;
73+
background-color: var(--quote-bg);
8474
}
8575

8676
.box.warning {
87-
border-left-color: var(--c-warning);
88-
background-color: rgba(255, 229, 100, .2);
89-
color: var(--c-warning-text);
77+
border-left-color: var(--c-warning);
78+
background-color: rgba(255, 229, 100, 0.2);
79+
color: var(--c-warning-text);
9080
}
9181

92-
.box.warning>.box-title{
93-
color: var(--c-warning-title);
82+
.box.warning > .box-title {
83+
color: var(--c-warning-title);
9484
}
9585

9686
.box.danger {
@@ -104,12 +94,11 @@ code {
10494
}
10595

10696
.spacer {
107-
width: 100%;
108-
height: 3px;
109-
margin: 25px 0px 25px 0px;
97+
width: 100%;
98+
height: 3px;
99+
margin: 25px 0px 25px 0px;
110100
}
111101

112-
113102
/* Global CSS variables */
114103

115104
:root {
@@ -140,7 +129,7 @@ code {
140129
}
141130

142131
.light {
143-
--c-warning-text: #746000;
132+
--c-warning-text: #746000;
144133
}
145134

146135
.navy {
@@ -150,5 +139,5 @@ code {
150139
}
151140

152141
.rust {
153-
--c-warning-text: #ad8e00;
142+
--c-warning-text: #ad8e00;
154143
}

src/fonts/fira_code.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@font-face {
2+
font-family: 'Fira Code';
3+
src: url('woff2/FiraCode-Light.woff2') format('woff2'),
4+
url("woff/FiraCode-Light.woff") format("woff");
5+
font-weight: 300;
6+
font-style: normal;
7+
}
8+
9+
@font-face {
10+
font-family: 'Fira Code';
11+
src: url('woff2/FiraCode-Regular.woff2') format('woff2'),
12+
url("woff/FiraCode-Regular.woff") format("woff");
13+
font-weight: 400;
14+
font-style: normal;
15+
}
16+
17+
@font-face {
18+
font-family: 'Fira Code';
19+
src: url('woff2/FiraCode-Medium.woff2') format('woff2'),
20+
url("woff/FiraCode-Medium.woff") format("woff");
21+
font-weight: 500;
22+
font-style: normal;
23+
}
24+
25+
@font-face {
26+
font-family: 'Fira Code';
27+
src: url('woff2/FiraCode-SemiBold.woff2') format('woff2'),
28+
url("woff/FiraCode-SemiBold.woff") format("woff");
29+
font-weight: 600;
30+
font-style: normal;
31+
}
32+
33+
@font-face {
34+
font-family: 'Fira Code';
35+
src: url('woff2/FiraCode-Bold.woff2') format('woff2'),
36+
url("woff/FiraCode-Bold.woff") format("woff");
37+
font-weight: 700;
38+
font-style: normal;
39+
}
40+
41+
@font-face {
42+
font-family: 'Fira Code VF';
43+
src: url('woff2/FiraCode-VF.woff2') format('woff2-variations'),
44+
url('woff/FiraCode-VF.woff') format('woff-variations');
45+
/* font-weight requires a range: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide#Using_a_variable_font_font-face_changes */
46+
font-weight: 300 700;
47+
font-style: normal;
48+
}

src/fonts/woff/FiraCode-Bold.woff

135 KB
Binary file not shown.

src/fonts/woff/FiraCode-Light.woff

128 KB
Binary file not shown.

src/fonts/woff/FiraCode-Medium.woff

128 KB
Binary file not shown.

src/fonts/woff/FiraCode-Regular.woff

128 KB
Binary file not shown.

src/fonts/woff/FiraCode-SemiBold.woff

134 KB
Binary file not shown.

src/fonts/woff/FiraCode-VF.woff

135 KB
Binary file not shown.

src/fonts/woff2/FiraCode-Bold.woff2

105 KB
Binary file not shown.

src/fonts/woff2/FiraCode-Light.woff2

101 KB
Binary file not shown.

0 commit comments

Comments
 (0)