rustdoc: use ttf based font for cjk glyphs
This commit is contained in:
parent
bdcb528512
commit
9e00501c1c
@ -39,9 +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-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,
|
||||
"NanumBarunGothic.ttf.woff2" => static_files::nanum_barun_gothic::REGULAR2,
|
||||
"NanumBarunGothic.ttf.woff" => static_files::nanum_barun_gothic::REGULAR,
|
||||
"NanumBarunGothic-LICENSE.txt" => static_files::nanum_barun_gothic::LICENSE,
|
||||
"LICENSE-MIT.txt" => static_files::LICENSE_MIT,
|
||||
"LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
|
||||
"COPYRIGHT.txt" => static_files::COPYRIGHT,
|
||||
|
@ -77,11 +77,11 @@
|
||||
|
||||
/* Avoid using legacy CJK serif fonts in Windows like Batang. */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans KR';
|
||||
src: url("noto-sans-kr-regular.woff2") format("woff2"),
|
||||
url("noto-sans-kr-regular.woff") format("woff");
|
||||
font-family: 'NanumBarunGothic';
|
||||
src: url("NanumBarunGothic.ttf.woff2") format("woff2"),
|
||||
url("NanumBarunGothic.ttf.woff") format("woff");
|
||||
font-display: swap;
|
||||
unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
|
||||
unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
|
||||
}
|
||||
|
||||
* {
|
||||
@ -108,7 +108,7 @@ html {
|
||||
/* General structure and fonts */
|
||||
|
||||
body {
|
||||
font: 16px/1.4 "Source Serif 4", "Noto Sans KR", serif;
|
||||
font: 16px/1.4 "Source Serif 4", NanumBarunGothic, serif;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
padding: 10px 15px 20px 15px;
|
||||
@ -197,7 +197,7 @@ div.impl-items > div:not(.docblock):not(.item-info),
|
||||
.content ul.crate a.crate, a.srclink,
|
||||
/* This selector is for the items listed in the "all items" page. */
|
||||
#main > ul.docblock > li > a {
|
||||
font-family: "Fira Sans", Arial, sans-serif;
|
||||
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
|
||||
}
|
||||
|
||||
.content ul.crate a.crate {
|
||||
|
@ -1,8 +1,14 @@
|
||||
Copyright 2014, 2015 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
||||
Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/),
|
||||
|
||||
with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic,
|
||||
NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen,
|
||||
Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco,
|
||||
NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic,
|
||||
Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
BIN
src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff
Normal file
BIN
src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff
Normal file
Binary file not shown.
BIN
src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff2
Normal file
BIN
src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -160,15 +160,35 @@ crate mod source_code_pro {
|
||||
crate static LICENSE: &[u8] = include_bytes!("static/fonts/SourceCodePro-LICENSE.txt");
|
||||
}
|
||||
|
||||
crate mod noto_sans_kr {
|
||||
/// 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");
|
||||
/// Files related to the Nanum Barun Gothic font.
|
||||
///
|
||||
/// These files are used to avoid some legacy CJK serif fonts in Windows.
|
||||
///
|
||||
/// Note that the Noto Sans KR font, which was used previously but was not very readable on Windows,
|
||||
/// has been replaced by the Nanum Barun Gothic font. This is due to Windows' implementation of font
|
||||
/// rendering that distorts OpenType fonts too much.
|
||||
///
|
||||
/// The font files were generated with these commands:
|
||||
///
|
||||
/// ```sh
|
||||
/// pyftsubset NanumBarunGothic.ttf \
|
||||
/// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
|
||||
/// --output-file=NanumBarunGothic.ttf.woff --flavor=woff
|
||||
/// ```
|
||||
/// ```sh
|
||||
/// pyftsubset NanumBarunGothic.ttf \
|
||||
/// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
|
||||
/// --output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2
|
||||
/// ```
|
||||
crate mod nanum_barun_gothic {
|
||||
/// The file `NanumBarunGothic.ttf.woff`, the Regular variant of the Nanum Barun Gothic font.
|
||||
crate static REGULAR: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff");
|
||||
|
||||
/// 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 `NanumBarunGothic.ttf.woff2`, the Regular variant of the Nanum Barun Gothic font.
|
||||
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.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");
|
||||
/// The file `NanumBarunGothic-LICENSE.txt`, the license text of the Nanum Barun Gothic font.
|
||||
crate static LICENSE: &[u8] = include_bytes!("static/fonts/NanumBarunGothic-LICENSE.txt");
|
||||
}
|
||||
|
||||
/// Files related to the sidebar in rustdoc sources.
|
||||
|
@ -1,23 +1,23 @@
|
||||
// This test checks that the correct font is used on module items (in index.html pages).
|
||||
goto: file://|DOC_PATH|/test_docs/index.html
|
||||
assert-css: (".item-table .module-item a", {"font-family": '"Fira Sans", Arial, sans-serif'}, ALL)
|
||||
assert-css: (".item-table .docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'}, ALL)
|
||||
assert-css: (".item-table .module-item a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, ALL)
|
||||
assert-css: (".item-table .docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'}, ALL)
|
||||
|
||||
// modules
|
||||
assert-css: ("#modules + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#modules + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#modules + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#modules + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
// structs
|
||||
assert-css: ("#structs + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#structs + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#structs + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#structs + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
// enums
|
||||
assert-css: ("#enums + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#enums + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#enums + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#enums + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
// traits
|
||||
assert-css: ("#traits + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#traits + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#traits + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#traits + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
// functions
|
||||
assert-css: ("#functions + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#functions + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#functions + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#functions + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
// keywords
|
||||
assert-css: ("#keywords + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, sans-serif'})
|
||||
assert-css: ("#keywords + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", "Noto Sans KR", serif'})
|
||||
assert-css: ("#keywords + .item-table .item-left a", {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'})
|
||||
assert-css: ("#keywords + .item-table .item-right.docblock-short", {"font-family": '"Source Serif 4", NanumBarunGothic, serif'})
|
||||
|
Loading…
x
Reference in New Issue
Block a user