Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CJK font in rustdoc #89782

Merged
merged 1 commit into from Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustdoc/html/render/write_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

* {
Expand Down
Binary file not shown.
Binary file not shown.
15 changes: 7 additions & 8 deletions src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down