Skip to content

Commit

Permalink
Use swap for base fonts in a font family
Browse files Browse the repository at this point in the history
Font-display options allow a CSS author to opt in to faster loading,
in exchange for less control over the display. Font-families will
fall back to a "nearby" (in weight/style) font. It is important
that some of the base fonts, like Source Serif Pro, load correctly.
Swap should be preferred for them.
  • Loading branch information
workingjubilee committed May 29, 2020
1 parent c938d58 commit 5f9d37f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
font-family: 'Fira Sans';
font-style: normal;
font-weight: 500;
font-display: swap;
font-display: fallback;
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
}

Expand All @@ -19,7 +19,9 @@
font-family: 'Source Serif Pro';
font-style: normal;
font-weight: 400;
font-display: fallback;
/* This is currently the base font for the entire cascade. It is important
* that it loads in order for rustdoc to look even slightly correct. */
font-display: swap;
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
}
@font-face {
Expand All @@ -42,7 +44,7 @@
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 400;
font-display: fallback;
font-display: swap;
/* Avoid using locally installed font because bad versions are in circulation:
* see https://github.com/rust-lang/rust/issues/24355 */
src: url("SourceCodePro-Regular.woff") format('woff');
Expand All @@ -51,7 +53,7 @@
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 600;
font-display: swap;
font-display: fallback;
src: url("SourceCodePro-Semibold.woff") format('woff');
}

Expand Down

0 comments on commit 5f9d37f

Please sign in to comment.