about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-11-23 23:00:30 -0800
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-11-23 23:13:52 -0800
commit4198fac7390509128c42757fcfb89a0effde4a8e (patch)
tree9590db4bb0839788a2f214b44aaf4642e27a760d
parentce3f3a5ffa7452131cde06c003cc2eaa7c729bfb (diff)
downloadrust-4198fac7390509128c42757fcfb89a0effde4a8e.tar.gz
rust-4198fac7390509128c42757fcfb89a0effde4a8e.zip
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.
-rw-r--r--src/librustdoc/html/templates/page.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html
index 9fafea69145..3d7232e5d83 100644
--- a/src/librustdoc/html/templates/page.html
+++ b/src/librustdoc/html/templates/page.html
@@ -7,6 +7,12 @@
     <meta name="description" content="{{page.description}}"> {#- -#}
     <meta name="keywords" content="{{page.keywords}}"> {#- -#}
     <title>{{page.title}}</title> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceSerif4-Regular.ttf.woff2"> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}FiraSans-Regular.woff2"> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}FiraSans-Medium.woff2"> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceCodePro-Regular.ttf.woff2"> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceSerif4-Bold.ttf.woff2"> {#- -#}
+    <link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path | safe}}SourceCodePro-Semibold.ttf.woff2"> {#- -#}
     <link rel="stylesheet" type="text/css" {# -#}
           href="{{static_root_path | safe}}normalize{{page.resource_suffix}}.css"> {#- -#}
     <link rel="stylesheet" type="text/css" {# -#}