mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #72092 - workingjubilee:patch-2, r=GuillaumeGomez
Unblock font loading in rustdoc.css rustdoc's font loading defaults to "auto", so browsers may block render. But rustdoc's case prefers a faster TTI for scrolling, this means the strictest font-display in use should be "swap". rustdoc's fonts do provide notable legibility improvements but first-time users will have little trouble reading without. This means "optional" is preferred. The one exception is Source Serif Pro: it's a big difference for body text, so "fallback" is preferred over "optional" to cause a (tiny) block. This follows up on (but does not resolve) #20962, taking PageSpeed Insight's rec fairly directly. Supporting reading material: https://drafts.csswg.org/css-fonts-4/#font-display-desc
This commit is contained in:
commit
238a0ce716
@ -3,12 +3,14 @@
|
|||||||
font-family: 'Fira Sans';
|
font-family: 'Fira Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
font-display: optional;
|
||||||
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
|
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Fira Sans';
|
font-family: 'Fira Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
font-display: optional;
|
||||||
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
|
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,18 +19,23 @@
|
|||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
/* The difference for body text without this font is greater than other fonts,
|
||||||
|
* so the 0~100ms block of fallback is preferred over optional, for legibility. */
|
||||||
|
font-display: fallback;
|
||||||
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
font-display: optional;
|
||||||
src: local('Source Serif Pro Italic'), url("SourceSerifPro-It.ttf.woff") format('woff');
|
src: local('Source Serif Pro Italic'), url("SourceSerifPro-It.ttf.woff") format('woff');
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
font-display: optional;
|
||||||
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +44,7 @@
|
|||||||
font-family: 'Source Code Pro';
|
font-family: 'Source Code Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
font-display: optional;
|
||||||
/* Avoid using locally installed font because bad versions are in circulation:
|
/* Avoid using locally installed font because bad versions are in circulation:
|
||||||
* see https://github.com/rust-lang/rust/issues/24355 */
|
* see https://github.com/rust-lang/rust/issues/24355 */
|
||||||
src: url("SourceCodePro-Regular.woff") format('woff');
|
src: url("SourceCodePro-Regular.woff") format('woff');
|
||||||
@ -45,6 +53,7 @@
|
|||||||
font-family: 'Source Code Pro';
|
font-family: 'Source Code Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
font-display: optional;
|
||||||
src: url("SourceCodePro-Semibold.woff") format('woff');
|
src: url("SourceCodePro-Semibold.woff") format('woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user