about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-02-26 15:52:36 +0100
committerGitHub <noreply@github.com>2021-02-26 15:52:36 +0100
commitb4ded5a07bf43fd8b645d8e18eeae6f522d574a6 (patch)
tree9627d71322bbd946ca39e215efae9dfd319df471 /src/librustdoc/html/render
parent6b5e141999cc2350c0322cef9a0b569f2908d341 (diff)
parentad7ed13eab09f2bb9311e4338de0fb347e700e73 (diff)
downloadrust-b4ded5a07bf43fd8b645d8e18eeae6f522d574a6.tar.gz
rust-b4ded5a07bf43fd8b645d8e18eeae6f522d574a6.zip
Rollup merge of #82545 - jsha:woff2, r=GuillaumeGomez
rustdoc: add optional woff2 versions of FiraSans.

For browsers that support woff2 (most modern ones:
https://caniuse.com/woff2), this offers a reduction in download size
for these two fonts from 362k to 257k (32% reduction). It decreases the
total page size for `struct.String.html` (counting all subresources) by
about 2.5%.

If this is interesting, I'm happy to apply the same treatment to the
other fonts, but these two are the biggest.
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 6665f160dec..58e9e41e6a5 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -883,6 +883,8 @@ themePicker.onblur = handleThemeButtonsBlur;
         static_files::NORMALIZE_CSS,
         options.enable_minification,
     )?;
+    write(cx.dst.join("FiraSans-Regular.woff2"), static_files::fira_sans::REGULAR2)?;
+    write(cx.dst.join("FiraSans-Medium.woff2"), static_files::fira_sans::MEDIUM2)?;
     write(cx.dst.join("FiraSans-Regular.woff"), static_files::fira_sans::REGULAR)?;
     write(cx.dst.join("FiraSans-Medium.woff"), static_files::fira_sans::MEDIUM)?;
     write(cx.dst.join("FiraSans-LICENSE.txt"), static_files::fira_sans::LICENSE)?;