Skip to content

Commit f9cfe15

Browse files
committed
Use Arial as fallback font instead of sans-serif.
On most platforms and browsers, `sans-serif` is equivalent to Arial. However, on Firefox on Ubuntu (and possibly other Linuxes), `sans-serif` is DejaVu Sans, a much wider font. This creates a larger shift in text when the custom fonts finally load. Arial is a web-safe font, and specifying it explicitly gives us more cross-platform consistency, as well as reducing the layout shift that happens when fonts load.
1 parent d3e7ffa commit f9cfe15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustdoc/html/static/rustdoc.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ h1, h2, h3, h4,
136136
#source-sidebar, #sidebar-toggle,
137137
/* This selector is for the items listed in the "all items" page. */
138138
#main > ul.docblock > li > a {
139-
font-family: "Fira Sans", sans-serif;
139+
font-family: "Fira Sans", Arial;
140140
}
141141

142142
.content ul.crate a.crate {
@@ -482,7 +482,7 @@ h4 > code, h3 > code, .invisible > code {
482482
}
483483
#main > .since {
484484
top: inherit;
485-
font-family: "Fira Sans", sans-serif;
485+
font-family: "Fira Sans", Arial;
486486
}
487487

488488
.content table:not(.table-display) {
@@ -1301,7 +1301,7 @@ h4 > .notable-traits {
13011301

13021302
.help-button {
13031303
right: 30px;
1304-
font-family: "Fira Sans",sans-serif;
1304+
font-family: "Fira Sans", Arial;
13051305
text-align: center;
13061306
font-size: 17px;
13071307
}

0 commit comments

Comments
 (0)