Skip to content

Commit 7eb368c

Browse files
akiyksJonathan Corbet
authored andcommitted
docs: pdfdocs: Choose Serif font as CJK mainfont if possible
"Noto Serif CJK SC" and its variants suit better with the roman font of Latin letters. On some distros such as Fedora, it is possible to partially install "Noto Sans CJK" fonts. So, if the Serif fonts are not found on the system, fall back to the Sans fonts. Signed-off-by: Akira Yokosawa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Corbet <[email protected]>
1 parent e291ff6 commit 7eb368c

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

Documentation/conf.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,48 @@
360360
\\IfFontExistsTF{Noto Sans CJK SC}{
361361
% This is needed for translations
362362
\\usepackage{xeCJK}
363-
\\setCJKmainfont{Noto Sans CJK SC}
363+
\\IfFontExistsTF{Noto Serif CJK SC}{
364+
\\setCJKmainfont{Noto Serif CJK SC}
365+
}{
366+
\\setCJKmainfont{Noto Sans CJK SC}
367+
}
364368
\\setCJKsansfont{Noto Sans CJK SC}
365369
\\setCJKmonofont{Noto Sans Mono CJK SC}
366370
% CJK Language-specific font choices
367-
\\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC}
371+
\\IfFontExistsTF{Noto Serif CJK SC}{
372+
\\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC}
373+
\\newCJKfontfamily[SCserif]\\scserif{Noto Serif CJK SC}
374+
}{
375+
\\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC}
376+
\\newCJKfontfamily[SCserif]\\scserif{Noto Sans CJK SC}
377+
}
368378
\\newCJKfontfamily[SCsans]\\scsans{Noto Sans CJK SC}
369379
\\newCJKfontfamily[SCmono]\\scmono{Noto Sans Mono CJK SC}
370-
\\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC}
380+
\\IfFontExistsTF{Noto Serif CJK TC}{
381+
\\newCJKfontfamily[TCmain]\\tcmain{Noto Serif CJK TC}
382+
\\newCJKfontfamily[TCserif]\\tcserif{Noto Serif CJK TC}
383+
}{
384+
\\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC}
385+
\\newCJKfontfamily[TCserif]\\tcserif{Noto Sans CJK TC}
386+
}
371387
\\newCJKfontfamily[TCsans]\\tcsans{Noto Sans CJK TC}
372388
\\newCJKfontfamily[TCmono]\\tcmono{Noto Sans Mono CJK TC}
373-
\\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR}
389+
\\IfFontExistsTF{Noto Serif CJK KR}{
390+
\\newCJKfontfamily[KRmain]\\krmain{Noto Serif CJK KR}
391+
\\newCJKfontfamily[KRserif]\\krserif{Noto Serif CJK KR}
392+
}{
393+
\\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR}
394+
\\newCJKfontfamily[KRserif]\\krserif{Noto Sans CJK KR}
395+
}
374396
\\newCJKfontfamily[KRsans]\\krsans{Noto Sans CJK KR}
375397
\\newCJKfontfamily[KRmono]\\krmono{Noto Sans Mono CJK KR}
376-
\\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP}
398+
\\IfFontExistsTF{Noto Serif CJK JP}{
399+
\\newCJKfontfamily[JPmain]\\jpmain{Noto Serif CJK JP}
400+
\\newCJKfontfamily[JPserif]\\jpserif{Noto Serif CJK JP}
401+
}{
402+
\\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP}
403+
\\newCJKfontfamily[JPserif]\\jpserif{Noto Sans CJK JP}
404+
}
377405
\\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP}
378406
\\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP}
379407
% Define custom macros to on/off CJK
@@ -387,20 +415,23 @@
387415
\\newcommand{\\kerneldocBeginTC}{%
388416
\\begingroup%
389417
\\tcmain%
418+
\\renewcommand{\\CJKrmdefault}{TCserif}%
390419
\\renewcommand{\\CJKsfdefault}{TCsans}%
391420
\\renewcommand{\\CJKttdefault}{TCmono}%
392421
}
393422
\\newcommand{\\kerneldocEndTC}{\\endgroup}
394423
\\newcommand{\\kerneldocBeginKR}{%
395424
\\begingroup%
396425
\\krmain%
426+
\\renewcommand{\\CJKrmdefault}{KRserif}%
397427
\\renewcommand{\\CJKsfdefault}{KRsans}%
398428
\\renewcommand{\\CJKttdefault}{KRmono}%
399429
}
400430
\\newcommand{\\kerneldocEndKR}{\\endgroup}
401431
\\newcommand{\\kerneldocBeginJP}{%
402432
\\begingroup%
403433
\\jpmain%
434+
\\renewcommand{\\CJKrmdefault}{JPserif}%
404435
\\renewcommand{\\CJKsfdefault}{JPsans}%
405436
\\renewcommand{\\CJKttdefault}{JPmono}%
406437
}

0 commit comments

Comments
 (0)