Skip to content

Commit 4198fac

Browse files
committed
Preload the most commonly used fonts.
Don't preload italic font faces because they aren't used on all pages, and when they are used, they are used sparingly so it's okay if they are slower to load.
1 parent ce3f3a5 commit 4198fac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/html/templates/page.html

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
<meta name="description" content="{{page.description}}"> {#- -#}
88
<meta name="keywords" content="{{page.keywords}}"> {#- -#}
99
<title>{{page.title}}</title> {#- -#}
10+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceSerif4-Regular.ttf.woff2"> {#- -#}
11+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}FiraSans-Regular.woff2"> {#- -#}
12+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}FiraSans-Medium.woff2"> {#- -#}
13+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceCodePro-Regular.ttf.woff2"> {#- -#}
14+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceSerif4-Bold.ttf.woff2"> {#- -#}
15+
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceCodePro-Semibold.ttf.woff2"> {#- -#}
1016
<link rel="stylesheet" type="text/css" {# -#}
1117
href="{{static_root_path | safe}}normalize{{page.resource_suffix}}.css"> {#- -#}
1218
<link rel="stylesheet" type="text/css" {# -#}

0 commit comments

Comments
 (0)