Skip to content

Commit

Permalink
Use Arial as fallback font instead of sans-serif.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsha committed Mar 3, 2021
1 parent d3e7ffa commit f9cfe15
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ h1, h2, h3, h4,
#source-sidebar, #sidebar-toggle,
/* This selector is for the items listed in the "all items" page. */
#main > ul.docblock > li > a {
font-family: "Fira Sans", sans-serif;
font-family: "Fira Sans", Arial;
}

.content ul.crate a.crate {
Expand Down Expand Up @@ -482,7 +482,7 @@ h4 > code, h3 > code, .invisible > code {
}
#main > .since {
top: inherit;
font-family: "Fira Sans", sans-serif;
font-family: "Fira Sans", Arial;
}

.content table:not(.table-display) {
Expand Down Expand Up @@ -1301,7 +1301,7 @@ h4 > .notable-traits {

.help-button {
right: 30px;
font-family: "Fira Sans",sans-serif;
font-family: "Fira Sans", Arial;
text-align: center;
font-size: 17px;
}
Expand Down

0 comments on commit f9cfe15

Please sign in to comment.