about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-10-13 21:55:12 +0900
committerGitHub <noreply@github.com>2021-10-13 21:55:12 +0900
commitcabfda428dcd986f090ecbec297746a2fc27fd9f (patch)
treed41aeeee419086d4f534ae3f61c3e4370833eb31 /src
parentf759fff44758c9971e4d6194b6cdcc448908af8f (diff)
parentd2564ce5a9c0e92d02976ba8386cc91880691340 (diff)
downloadrust-cabfda428dcd986f090ecbec297746a2fc27fd9f.tar.gz
rust-cabfda428dcd986f090ecbec297746a2fc27fd9f.zip
Rollup merge of #89782 - konan8205:develop, r=jsha
Improve CJK font in rustdoc

This PR includes:
- Fix unicode range of korean letters in `rustdoc.css`.
- Add WOFF2 format version of Noto Sans KR font.
- Shorten the font file name.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/write_shared.rs5
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css7
-rw-r--r--src/librustdoc/html/static/fonts/noto-sans-kr-LICENSE.txt (renamed from src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt)0
-rw-r--r--src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff (renamed from src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular.woff)bin287068 -> 279528 bytes
-rw-r--r--src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2bin0 -> 245248 bytes
-rw-r--r--src/librustdoc/html/static_files.rs15
6 files changed, 14 insertions, 13 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index c1a83ad5820..e4c2556118a 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -39,8 +39,9 @@ static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| {
         "SourceCodePro-Semibold.ttf.woff" => static_files::source_code_pro::SEMIBOLD,
         "SourceCodePro-It.ttf.woff" => static_files::source_code_pro::ITALIC,
         "SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE,
-        "noto-sans-kr-v13-korean-regular.woff" => static_files::noto_sans_kr::REGULAR,
-        "noto-sans-kr-v13-korean-regular-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
+        "noto-sans-kr-regular.woff2" => static_files::noto_sans_kr::REGULAR2,
+        "noto-sans-kr-regular.woff" => static_files::noto_sans_kr::REGULAR,
+        "noto-sans-kr-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
         "LICENSE-MIT.txt" => static_files::LICENSE_MIT,
         "LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
         "COPYRIGHT.txt" => static_files::COPYRIGHT,
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 962af66368d..11c54876dea 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -75,12 +75,13 @@
 	font-display: swap;
 }
 
-/* Avoid using legacy CJK serif fonts in Windows like Batang */
+/* Avoid using legacy CJK serif fonts in Windows like Batang. */
 @font-face {
 	font-family: 'Noto Sans KR';
-	src: url("noto-sans-kr-v13-korean-regular.woff") format("woff");
+	src: url("noto-sans-kr-regular.woff2") format("woff2"),
+		url("noto-sans-kr-regular.woff") format("woff");
 	font-display: swap;
-	unicode-range: U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
+	unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
 }
 
 * {
diff --git a/src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt b/src/librustdoc/html/static/fonts/noto-sans-kr-LICENSE.txt
index 922d5fdc18d..922d5fdc18d 100644
--- a/src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt
+++ b/src/librustdoc/html/static/fonts/noto-sans-kr-LICENSE.txt
diff --git a/src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular.woff b/src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff
index 01d6b6b5466..65e939c6b9f 100644
--- a/src/librustdoc/html/static/fonts/noto-sans-kr-v13-korean-regular.woff
+++ b/src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff
Binary files differdiff --git a/src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2 b/src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2
new file mode 100644
index 00000000000..8126492e41d
--- /dev/null
+++ b/src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2
Binary files differdiff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index ccc25e6cc49..924e3f1d29d 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -157,15 +157,14 @@ crate mod source_code_pro {
 }
 
 crate mod noto_sans_kr {
-    /// The file `noto-sans-kr-v13-korean-regular.woff`, the Regular variant of the Noto Sans KR
-    /// font.
-    crate static REGULAR: &[u8] =
-        include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular.woff");
+    /// The file `noto-sans-kr.woff`, the Regular variant of the Noto Sans KR font.
+    crate static REGULAR: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff");
 
-    /// The file `noto-sans-kr-v13-korean-regular-LICENSE.txt`, the license text of the Noto Sans KR
-    /// font.
-    crate static LICENSE: &[u8] =
-        include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt");
+    /// The file `noto-sans-kr.woff2`, the Regular variant of the Noto Sans KR font.
+    crate static REGULAR2: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff2");
+
+    /// The file `noto-sans-kr-LICENSE.txt`, the license text of the Noto Sans KR font.
+    crate static LICENSE: &[u8] = include_bytes!("static/fonts/noto-sans-kr-LICENSE.txt");
 }
 
 /// Files related to the sidebar in rustdoc sources.