Skip to content

Commit 3164052

Browse files
authored
Rollup merge of rust-lang#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.
2 parents a866484 + d2564ce commit 3164052

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

src/librustdoc/html/render/write_shared.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| {
3939
"SourceCodePro-Semibold.ttf.woff" => static_files::source_code_pro::SEMIBOLD,
4040
"SourceCodePro-It.ttf.woff" => static_files::source_code_pro::ITALIC,
4141
"SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE,
42-
"noto-sans-kr-v13-korean-regular.woff" => static_files::noto_sans_kr::REGULAR,
43-
"noto-sans-kr-v13-korean-regular-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
42+
"noto-sans-kr-regular.woff2" => static_files::noto_sans_kr::REGULAR2,
43+
"noto-sans-kr-regular.woff" => static_files::noto_sans_kr::REGULAR,
44+
"noto-sans-kr-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
4445
"LICENSE-MIT.txt" => static_files::LICENSE_MIT,
4546
"LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
4647
"COPYRIGHT.txt" => static_files::COPYRIGHT,

src/librustdoc/html/static/css/rustdoc.css

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@
7575
font-display: swap;
7676
}
7777

78-
/* Avoid using legacy CJK serif fonts in Windows like Batang */
78+
/* Avoid using legacy CJK serif fonts in Windows like Batang. */
7979
@font-face {
8080
font-family: 'Noto Sans KR';
81-
src: url("noto-sans-kr-v13-korean-regular.woff") format("woff");
81+
src: url("noto-sans-kr-regular.woff2") format("woff2"),
82+
url("noto-sans-kr-regular.woff") format("woff");
8283
font-display: swap;
83-
unicode-range: U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
84+
unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
8485
}
8586

8687
* {
Binary file not shown.

src/librustdoc/html/static_files.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,14 @@ crate mod source_code_pro {
157157
}
158158

159159
crate mod noto_sans_kr {
160-
/// The file `noto-sans-kr-v13-korean-regular.woff`, the Regular variant of the Noto Sans KR
161-
/// font.
162-
crate static REGULAR: &[u8] =
163-
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular.woff");
160+
/// The file `noto-sans-kr.woff`, the Regular variant of the Noto Sans KR font.
161+
crate static REGULAR: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff");
164162

165-
/// The file `noto-sans-kr-v13-korean-regular-LICENSE.txt`, the license text of the Noto Sans KR
166-
/// font.
167-
crate static LICENSE: &[u8] =
168-
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt");
163+
/// The file `noto-sans-kr.woff2`, the Regular variant of the Noto Sans KR font.
164+
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff2");
165+
166+
/// The file `noto-sans-kr-LICENSE.txt`, the license text of the Noto Sans KR font.
167+
crate static LICENSE: &[u8] = include_bytes!("static/fonts/noto-sans-kr-LICENSE.txt");
169168
}
170169

171170
/// Files related to the sidebar in rustdoc sources.

0 commit comments

Comments
 (0)