Commit 66939df5 authored by Akira Yokosawa's avatar Akira Yokosawa Committed by Jonathan Corbet

docs: pdfdocs: Switch default CJK font to KR variants

xeCJK is enabled in Table of Contents (TOC) so that translations.pdf
built by top-level "make pdfdocs" can have its TOC typeset properly.

This causes quotation marks and apostrophe symbols appear too wide in
Latin-script docs.
This is because (1) Sphinx converts ASCII symbols into multi-byte
UTF-8 ones in LaTeX and (2) in the SC variant of "Noto CJK" font
families, those UTF-8 symbols have full-width glyph.

The KR variant of the font families has half-width glyph for those
symbols and TOC pages should look nicer when it is used instead.

Switch the default CJK font families to the KR variant and teach
xeCJK of those symbols' widths.
To compensate the switch, teach xeCJK of the width in the SC and
TC variants.
Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/0c8ea878-0a6f-ea01-ab45-4e66c5facee9@gmail.comSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 8716ef41
...@@ -460,13 +460,15 @@ latex_elements['preamble'] += ''' ...@@ -460,13 +460,15 @@ latex_elements['preamble'] += '''
\\IfFontExistsTF{Noto Sans CJK SC}{ \\IfFontExistsTF{Noto Sans CJK SC}{
% This is needed for translations % This is needed for translations
\\usepackage{xeCJK} \\usepackage{xeCJK}
\\IfFontExistsTF{Noto Serif CJK SC}{ \\IfFontExistsTF{Noto Serif CJK KR}{
\\setCJKmainfont{Noto Serif CJK SC}[AutoFakeSlant] \\setCJKmainfont{Noto Serif CJK KR}[AutoFakeSlant]
}{ }{
\\setCJKmainfont{Noto Sans CJK SC}[AutoFakeSlant] \\setCJKmainfont{Noto Sans CJK KR}[AutoFakeSlant]
} }
\\setCJKsansfont{Noto Sans CJK SC}[AutoFakeSlant] \\setCJKsansfont{Noto Sans CJK KR}[AutoFakeSlant]
\\setCJKmonofont{Noto Sans Mono CJK SC}[AutoFakeSlant] \\setCJKmonofont{Noto Sans Mono CJK KR}[AutoFakeSlant]
\\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}
\\xeCJKDeclareCharClass{HalfRight}{`”,`’}
% CJK Language-specific font choices % CJK Language-specific font choices
\\IfFontExistsTF{Noto Serif CJK SC}{ \\IfFontExistsTF{Noto Serif CJK SC}{
\\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC}[AutoFakeSlant] \\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC}[AutoFakeSlant]
...@@ -513,11 +515,18 @@ latex_elements['preamble'] += ''' ...@@ -513,11 +515,18 @@ latex_elements['preamble'] += '''
\\newcommand{\\kerneldocBeginSC}{% \\newcommand{\\kerneldocBeginSC}{%
\\begingroup% \\begingroup%
\\scmain% \\scmain%
\\xeCJKDeclareCharClass{FullLeft}{`“,`‘}%
\\xeCJKDeclareCharClass{FullRight}{`”,`’}%
\\renewcommand{\\CJKrmdefault}{SCserif}%
\\renewcommand{\\CJKsfdefault}{SCsans}%
\\renewcommand{\\CJKttdefault}{SCmono}%
} }
\\newcommand{\\kerneldocEndSC}{\\endgroup} \\newcommand{\\kerneldocEndSC}{\\endgroup}
\\newcommand{\\kerneldocBeginTC}{% \\newcommand{\\kerneldocBeginTC}{%
\\begingroup% \\begingroup%
\\tcmain% \\tcmain%
\\xeCJKDeclareCharClass{FullLeft}{`“,`‘}%
\\xeCJKDeclareCharClass{FullRight}{`”,`’}%
\\renewcommand{\\CJKrmdefault}{TCserif}% \\renewcommand{\\CJKrmdefault}{TCserif}%
\\renewcommand{\\CJKsfdefault}{TCsans}% \\renewcommand{\\CJKsfdefault}{TCsans}%
\\renewcommand{\\CJKttdefault}{TCmono}% \\renewcommand{\\CJKttdefault}{TCmono}%
...@@ -525,8 +534,6 @@ latex_elements['preamble'] += ''' ...@@ -525,8 +534,6 @@ latex_elements['preamble'] += '''
\\newcommand{\\kerneldocEndTC}{\\endgroup} \\newcommand{\\kerneldocEndTC}{\\endgroup}
\\newcommand{\\kerneldocBeginKR}{% \\newcommand{\\kerneldocBeginKR}{%
\\begingroup% \\begingroup%
\\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}%
\\xeCJKDeclareCharClass{HalfRight}{`”,`’}%
\\krmain% \\krmain%
\\renewcommand{\\CJKrmdefault}{KRserif}% \\renewcommand{\\CJKrmdefault}{KRserif}%
\\renewcommand{\\CJKsfdefault}{KRsans}% \\renewcommand{\\CJKsfdefault}{KRsans}%
...@@ -536,8 +543,6 @@ latex_elements['preamble'] += ''' ...@@ -536,8 +543,6 @@ latex_elements['preamble'] += '''
\\newcommand{\\kerneldocEndKR}{\\endgroup} \\newcommand{\\kerneldocEndKR}{\\endgroup}
\\newcommand{\\kerneldocBeginJP}{% \\newcommand{\\kerneldocBeginJP}{%
\\begingroup% \\begingroup%
\\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}%
\\xeCJKDeclareCharClass{HalfRight}{`”,`’}%
\\jpmain% \\jpmain%
\\renewcommand{\\CJKrmdefault}{JPserif}% \\renewcommand{\\CJKrmdefault}{JPserif}%
\\renewcommand{\\CJKsfdefault}{JPsans}% \\renewcommand{\\CJKsfdefault}{JPsans}%
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment