1
0
mirror of https://git.FreeBSD.org/doc.git synced 2026-06-02 11:25:20 +00:00

documentation/pdf: Improve zh-cn|zh-tw font issues

The build script now uses fonts installed by the port/pkg
docproj-fonts-cjk.

Differential Revision:	https://reviews.freebsd.org/D36623
Differential Revision:	https://reviews.freebsd.org/D37447
Co-authored-by:	Danilo G. Baio <dbaio@FreeBSD.org>
This commit is contained in:
Yan Hao Wang
2023-01-20 16:50:45 -03:00
committed by Danilo G. Baio
parent c5fa554557
commit 6a430fe152
3 changed files with 56 additions and 1 deletions
+24 -1
View File
@@ -49,6 +49,8 @@ build_pdf() {
local cur_dir_source="content/$doc_lang/$doc_type/$doc_name/"
local cur_dir_output="public/$doc_lang/$doc_type/$doc_name/"
local theme_font=""
if [ ! -d "$cur_dir_output" ]; then
mkdir -p "$cur_dir_output"
fi
@@ -68,6 +70,27 @@ build_pdf() {
local asciidoctor_file_name="_index.adoc"
fi
# Check non default fonts
case "$doc_lang" in
zh-cn)
if [ ! -f "$LOCALBASE/share/docproj-fonts-cjk/NotoSansSC-Medium.otf" ]; then
echo " font not found, skipping pdf build"
return
fi
theme_font="-a scripts=cjk -a pdf-theme=./shared/zh-cn/zh-cn-theme.yml -a pdf-fontsdir=$LOCALBASE/share/docproj-fonts-cjk"
;;
zh-tw)
if [ ! -f "$LOCALBASE/share/docproj-fonts-cjk/NotoSansTC-Medium.otf" ]; then
echo " font not found, skipping pdf build"
return
fi
theme_font="-a pdf-theme=./shared/zh-tw/zh-tw-theme.yml -a pdf-fontsdir=$LOCALBASE/share/docproj-fonts-cjk/"
;;
*)
theme_font="-a pdf-theme=default-with-fallback-font"
;;
esac
$ASCIIDOCTORPDF_CMD \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/git-macro.rb \
@@ -80,7 +103,7 @@ build_pdf() {
-a lang="$doc_lang" \
-a isonline=1 \
-a env-beastie=1 \
-a pdf-theme=default-with-fallback-font \
${theme_font} \
-o "${cur_dir_output}${doc_name}_${doc_lang}.pdf" \
"${cur_dir_source}${asciidoctor_file_name}"
}
+16
View File
@@ -0,0 +1,16 @@
extends: default
font:
catalog:
merge: true
Noto Sans SC: NotoSansSC-Medium.otf
fallbacks:
- Noto Serif
base:
text-align: left
font-family: Noto Sans SC
codespan:
font-family: Noto Sans SC
kbd:
font-family: $codespan-font-family
code:
font-family: $codespan-font-family
+16
View File
@@ -0,0 +1,16 @@
extends: default
font:
catalog:
merge: true
Noto Sans TC: NotoSansTC-Medium.otf
fallbacks:
- Noto Serif
base:
text-align: left
font-family: Noto Sans TC
codespan:
font-family: Noto Sans TC
kbd:
font-family: $codespan-font-family
code:
font-family: $codespan-font-family