From 659653c9e5468809a83901f833cefed1b04c5922 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:12:05 +0900 Subject: docs: pdfdocs: Refactor config for CJK document To make generated LaTeX code portable across systems with different sets of available fonts, convert font-availability check in python code to LaTeX code by using a conditional command provided by the "fontspec" package. This will help those who run Sphinx on one machine/container and run latexmk on other machines/containers. Remove import of check_output as it is unused any more. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/4baf88af-316d-8aee-240f-6ccbc20907d7@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index 7d92ec3e5b6e8f..b440cb606d22cb 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -16,8 +16,6 @@ import sys import os import sphinx -from subprocess import check_output - # Get Sphinx version major, minor, patch = sphinx.version_info[:3] @@ -355,15 +353,14 @@ latex_elements = { ''', } -# At least one book (translations) may have Asian characters -# with are only displayed if xeCJK is used +# Translations have Asian (CJK) characters which are only displayed if +# xeCJK is used -cjk_cmd = check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore') -if cjk_cmd.find("Noto Sans CJK SC") >= 0: - latex_elements['preamble'] += ''' +latex_elements['preamble'] += ''' + \\IfFontExistsTF{Noto Sans CJK SC}{ % This is needed for translations - \\usepackage{xeCJK} - \\setCJKmainfont{Noto Sans CJK SC} + \\usepackage{xeCJK} + \\setCJKmainfont{Noto Sans CJK SC} % Define custom macros to on/off CJK \\newcommand{\\kerneldocCJKon}{\\makexeCJKactive} \\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive} @@ -371,13 +368,12 @@ if cjk_cmd.find("Noto Sans CJK SC") >= 0: \\usepackage{etoolbox} % Inactivate CJK after tableofcontents \\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{} - ''' -else: - latex_elements['preamble'] += ''' + }{ % No CJK font found % Custom macros to on/off CJK (Dummy) \\newcommand{\\kerneldocCJKon}{} \\newcommand{\\kerneldocCJKoff}{} - ''' + } +''' # Fix reference escape troubles with Sphinx 1.4.x if major == 1: -- cgit 1.2.3-korg From e291ff6f5a034adb9b6ceaeb504ef196cde0ea9e Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:14:53 +0900 Subject: docs: pdfdocs: Add CJK-language-specific font settings zh_TW, ko_KR, and ja_JP translations have their preferred glyph sets different from that of zh_CN. To switch CJK font in the middle of the translations, introduce custom LaTeX macros listed below: \kerneldocBeginSC \kerneldocEndSC \kerneldocBeginTC \kerneldocEndTC \kerneldocBeginKR \kerneldocEndKR \kerneldocBeginJP \kerneldocEndJP , and embed a pair of macros in each language's index.rst. NOTE 1: Update of zh_TW/index.rst is deferred to a follow-up change. NOTE 2: Custom macros added here do not imply \kerneldocCJK(on|off). This is intentional. For example, \kerneldocCJKoff needs to be at the top of Italian translations' index.rst for the footer of final zh_TW page to be properly typeset. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/31906baf-7490-68cd-7153-4e4d320fb9b0@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 51 +++++++++++++++++++++++++++++- Documentation/translations/ja_JP/index.rst | 5 +++ Documentation/translations/ko_KR/index.rst | 2 ++ Documentation/translations/zh_CN/index.rst | 5 +++ 4 files changed, 62 insertions(+), 1 deletion(-) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index b440cb606d22cb..24e5427588e78e 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -361,10 +361,51 @@ latex_elements['preamble'] += ''' % This is needed for translations \\usepackage{xeCJK} \\setCJKmainfont{Noto Sans CJK SC} + \\setCJKsansfont{Noto Sans CJK SC} + \\setCJKmonofont{Noto Sans Mono CJK SC} + % CJK Language-specific font choices + \\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC} + \\newCJKfontfamily[SCsans]\\scsans{Noto Sans CJK SC} + \\newCJKfontfamily[SCmono]\\scmono{Noto Sans Mono CJK SC} + \\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC} + \\newCJKfontfamily[TCsans]\\tcsans{Noto Sans CJK TC} + \\newCJKfontfamily[TCmono]\\tcmono{Noto Sans Mono CJK TC} + \\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR} + \\newCJKfontfamily[KRsans]\\krsans{Noto Sans CJK KR} + \\newCJKfontfamily[KRmono]\\krmono{Noto Sans Mono CJK KR} + \\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP} + \\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP} + \\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP} % Define custom macros to on/off CJK \\newcommand{\\kerneldocCJKon}{\\makexeCJKactive} \\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive} - % To customize \sphinxtableofcontents + \\newcommand{\\kerneldocBeginSC}{% + \\begingroup% + \\scmain% + } + \\newcommand{\\kerneldocEndSC}{\\endgroup} + \\newcommand{\\kerneldocBeginTC}{% + \\begingroup% + \\tcmain% + \\renewcommand{\\CJKsfdefault}{TCsans}% + \\renewcommand{\\CJKttdefault}{TCmono}% + } + \\newcommand{\\kerneldocEndTC}{\\endgroup} + \\newcommand{\\kerneldocBeginKR}{% + \\begingroup% + \\krmain% + \\renewcommand{\\CJKsfdefault}{KRsans}% + \\renewcommand{\\CJKttdefault}{KRmono}% + } + \\newcommand{\\kerneldocEndKR}{\\endgroup} + \\newcommand{\\kerneldocBeginJP}{% + \\begingroup% + \\jpmain% + \\renewcommand{\\CJKsfdefault}{JPsans}% + \\renewcommand{\\CJKttdefault}{JPmono}% + } + \\newcommand{\\kerneldocEndJP}{\\endgroup} + % To customize \\sphinxtableofcontents \\usepackage{etoolbox} % Inactivate CJK after tableofcontents \\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{} @@ -372,6 +413,14 @@ latex_elements['preamble'] += ''' % Custom macros to on/off CJK (Dummy) \\newcommand{\\kerneldocCJKon}{} \\newcommand{\\kerneldocCJKoff}{} + \\newcommand{\\kerneldocBeginSC}{} + \\newcommand{\\kerneldocEndSC}{} + \\newcommand{\\kerneldocBeginTC}{} + \\newcommand{\\kerneldocEndTC}{} + \\newcommand{\\kerneldocBeginKR}{} + \\newcommand{\\kerneldocEndKR}{} + \\newcommand{\\kerneldocBeginSC}{} + \\newcommand{\\kerneldocEndKR}{} } ''' diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst index f94ba62d41c36e..88d4d98eed15a3 100644 --- a/Documentation/translations/ja_JP/index.rst +++ b/Documentation/translations/ja_JP/index.rst @@ -3,6 +3,7 @@ \renewcommand\thesection* \renewcommand\thesubsection* \kerneldocCJKon + \kerneldocBeginJP Japanese translations ===================== @@ -11,3 +12,7 @@ Japanese translations :maxdepth: 1 howto + +.. raw:: latex + + \kerneldocEndJP diff --git a/Documentation/translations/ko_KR/index.rst b/Documentation/translations/ko_KR/index.rst index 6ae258118bdf2d..f636b482fb4c13 100644 --- a/Documentation/translations/ko_KR/index.rst +++ b/Documentation/translations/ko_KR/index.rst @@ -3,6 +3,7 @@ \renewcommand\thesection* \renewcommand\thesubsection* \kerneldocCJKon + \kerneldocBeginKR 한국어 번역 =========== @@ -26,3 +27,4 @@ .. raw:: latex \normalsize + \kerneldocEndKR diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst index 8d68c98fd7c5f9..a34e58733ac8c5 100644 --- a/Documentation/translations/zh_CN/index.rst +++ b/Documentation/translations/zh_CN/index.rst @@ -5,6 +5,7 @@ \renewcommand\thesection* \renewcommand\thesubsection* \kerneldocCJKon + \kerneldocBeginSC .. _linux_doc_zh: @@ -189,3 +190,7 @@ TODOList: ---------- * :ref:`genindex` + +.. raw:: latex + + \kerneldocEndSC -- cgit 1.2.3-korg From 7eb368cc319bbf87ce1c6091a4ddc8bd01ee35d5 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:17:00 +0900 Subject: 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 Link: https://lore.kernel.org/r/5e454140-5d0c-35d4-8c31-3ffb2420793a@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index 24e5427588e78e..980be06df723ed 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -360,20 +360,48 @@ latex_elements['preamble'] += ''' \\IfFontExistsTF{Noto Sans CJK SC}{ % This is needed for translations \\usepackage{xeCJK} - \\setCJKmainfont{Noto Sans CJK SC} + \\IfFontExistsTF{Noto Serif CJK SC}{ + \\setCJKmainfont{Noto Serif CJK SC} + }{ + \\setCJKmainfont{Noto Sans CJK SC} + } \\setCJKsansfont{Noto Sans CJK SC} \\setCJKmonofont{Noto Sans Mono CJK SC} % CJK Language-specific font choices - \\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC} + \\IfFontExistsTF{Noto Serif CJK SC}{ + \\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC} + \\newCJKfontfamily[SCserif]\\scserif{Noto Serif CJK SC} + }{ + \\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC} + \\newCJKfontfamily[SCserif]\\scserif{Noto Sans CJK SC} + } \\newCJKfontfamily[SCsans]\\scsans{Noto Sans CJK SC} \\newCJKfontfamily[SCmono]\\scmono{Noto Sans Mono CJK SC} - \\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC} + \\IfFontExistsTF{Noto Serif CJK TC}{ + \\newCJKfontfamily[TCmain]\\tcmain{Noto Serif CJK TC} + \\newCJKfontfamily[TCserif]\\tcserif{Noto Serif CJK TC} + }{ + \\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC} + \\newCJKfontfamily[TCserif]\\tcserif{Noto Sans CJK TC} + } \\newCJKfontfamily[TCsans]\\tcsans{Noto Sans CJK TC} \\newCJKfontfamily[TCmono]\\tcmono{Noto Sans Mono CJK TC} - \\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR} + \\IfFontExistsTF{Noto Serif CJK KR}{ + \\newCJKfontfamily[KRmain]\\krmain{Noto Serif CJK KR} + \\newCJKfontfamily[KRserif]\\krserif{Noto Serif CJK KR} + }{ + \\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR} + \\newCJKfontfamily[KRserif]\\krserif{Noto Sans CJK KR} + } \\newCJKfontfamily[KRsans]\\krsans{Noto Sans CJK KR} \\newCJKfontfamily[KRmono]\\krmono{Noto Sans Mono CJK KR} - \\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP} + \\IfFontExistsTF{Noto Serif CJK JP}{ + \\newCJKfontfamily[JPmain]\\jpmain{Noto Serif CJK JP} + \\newCJKfontfamily[JPserif]\\jpserif{Noto Serif CJK JP} + }{ + \\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP} + \\newCJKfontfamily[JPserif]\\jpserif{Noto Sans CJK JP} + } \\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP} \\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP} % Define custom macros to on/off CJK @@ -387,6 +415,7 @@ latex_elements['preamble'] += ''' \\newcommand{\\kerneldocBeginTC}{% \\begingroup% \\tcmain% + \\renewcommand{\\CJKrmdefault}{TCserif}% \\renewcommand{\\CJKsfdefault}{TCsans}% \\renewcommand{\\CJKttdefault}{TCmono}% } @@ -394,6 +423,7 @@ latex_elements['preamble'] += ''' \\newcommand{\\kerneldocBeginKR}{% \\begingroup% \\krmain% + \\renewcommand{\\CJKrmdefault}{KRserif}% \\renewcommand{\\CJKsfdefault}{KRsans}% \\renewcommand{\\CJKttdefault}{KRmono}% } @@ -401,6 +431,7 @@ latex_elements['preamble'] += ''' \\newcommand{\\kerneldocBeginJP}{% \\begingroup% \\jpmain% + \\renewcommand{\\CJKrmdefault}{JPserif}% \\renewcommand{\\CJKsfdefault}{JPsans}% \\renewcommand{\\CJKttdefault}{JPmono}% } -- cgit 1.2.3-korg From 35382965bdd2feeedd0f2fe326c89db2007149bb Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:19:24 +0900 Subject: docs: pdfdocs: Preserve inter-phrase space in Korean translations In Korean typesetting, inter-phrase spaces in Hangul text have a similar role as the the inter-word spaces in Latin text. They can be preserved by the \xeCJKsetup{CJKspace=true} option. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/68de2e52-e6d1-3f01-c097-15ba7b28a319@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 1 + 1 file changed, 1 insertion(+) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index 980be06df723ed..2ccfe4442acc50 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -426,6 +426,7 @@ latex_elements['preamble'] += ''' \\renewcommand{\\CJKrmdefault}{KRserif}% \\renewcommand{\\CJKsfdefault}{KRsans}% \\renewcommand{\\CJKttdefault}{KRmono}% + \\xeCJKsetup{CJKspace = true} % For inter-phrase space } \\newcommand{\\kerneldocEndKR}{\\endgroup} \\newcommand{\\kerneldocBeginJP}{% -- cgit 1.2.3-korg From 77abc2c230b101fd35af739bf89a4430ddcfea62 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:23:57 +0900 Subject: docs: pdfdocs: One-half spacing for CJK translations CJK documents are much easier to read with a wider baseline stretch. Applying onehalfspacing option of "setspace" package looks reasonable. Note: \usepackage{setspace} needs to be before that of hyperref in the preamble. The 'extrapackages' key (available since Sphinx 2.3) is for this purpose. For systems with Sphinx < 2.3, dummy commands of \onehalfspacing and \singlespacing are provided instead. One-half spacing is not effective in LaTeX sources generated by such revisions of Sphinx. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/547a1f1c-0bb5-20a7-ea0e-951bfc3c3925@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 12 ++++++++++-- Documentation/translations/ja_JP/howto.rst | 8 ++++++++ Documentation/translations/ko_KR/howto.rst | 8 ++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index 2ccfe4442acc50..f219a7a41f4807 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -341,6 +341,9 @@ latex_elements = { verbatimhintsturnover=false, ''', + # For CJK One-half spacing, need to be in front of hyperref + 'extrapackages': r'\usepackage{setspace}', + # Additional stuff for the LaTeX preamble. 'preamble': ''' % Prevent column squeezing of tabulary. @@ -404,9 +407,12 @@ latex_elements['preamble'] += ''' } \\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP} \\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP} + % Dummy commands for Sphinx < 2.3 (no 'extrapackages' support) + \\providecommand{\\onehalfspacing}{} + \\providecommand{\\singlespacing}{} % Define custom macros to on/off CJK - \\newcommand{\\kerneldocCJKon}{\\makexeCJKactive} - \\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive} + \\newcommand{\\kerneldocCJKon}{\\makexeCJKactive\\onehalfspacing} + \\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive\\singlespacing} \\newcommand{\\kerneldocBeginSC}{% \\begingroup% \\scmain% @@ -437,6 +443,8 @@ latex_elements['preamble'] += ''' \\renewcommand{\\CJKttdefault}{JPmono}% } \\newcommand{\\kerneldocEndJP}{\\endgroup} + % Single spacing in literal blocks + \\fvset{baselinestretch=1} % To customize \\sphinxtableofcontents \\usepackage{etoolbox} % Inactivate CJK after tableofcontents diff --git a/Documentation/translations/ja_JP/howto.rst b/Documentation/translations/ja_JP/howto.rst index 73ebdab4ced73f..d667f9d8a02a0a 100644 --- a/Documentation/translations/ja_JP/howto.rst +++ b/Documentation/translations/ja_JP/howto.rst @@ -1,3 +1,7 @@ +.. raw:: latex + + \kerneldocCJKoff + NOTE: This is a version of Documentation/process/howto.rst translated into Japanese. This document is maintained by Tsugikazu Shibata @@ -11,6 +15,10 @@ try to update the original English file first. ---------------------------------- +.. raw:: latex + + \kerneldocCJKon + この文書は、 Documentation/process/howto.rst の和訳です。 diff --git a/Documentation/translations/ko_KR/howto.rst b/Documentation/translations/ko_KR/howto.rst index a2bdd564c907a0..e3cdf0c848926f 100644 --- a/Documentation/translations/ko_KR/howto.rst +++ b/Documentation/translations/ko_KR/howto.rst @@ -1,3 +1,7 @@ +.. raw:: latex + + \kerneldocCJKoff + NOTE: This is a version of Documentation/process/howto.rst translated into korean This document is maintained by Minchan Kim @@ -11,6 +15,10 @@ try to update the original English file first. ---------------------------------- +.. raw:: latex + + \kerneldocCJKon + 이 문서는 Documentation/process/howto.rst 의 한글 번역입니다. -- cgit 1.2.3-korg From 788d28a257991d673e57500353d416488df0c103 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:25:25 +0900 Subject: docs: pdfdocs: Permit AutoFakeSlant for CJK fonts Noto CJK fonts don't provide italic shapes. The AutoFakeSlant option of fontspec and xeCJK packages can be used as a workaround. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/502335cc-9a95-3c2a-7744-6cc56ecaf628@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 56 +++++++++++++++++++------------------- Documentation/translations/conf.py | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index f219a7a41f4807..afa085c7178183 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -364,49 +364,49 @@ latex_elements['preamble'] += ''' % This is needed for translations \\usepackage{xeCJK} \\IfFontExistsTF{Noto Serif CJK SC}{ - \\setCJKmainfont{Noto Serif CJK SC} + \\setCJKmainfont{Noto Serif CJK SC}[AutoFakeSlant] }{ - \\setCJKmainfont{Noto Sans CJK SC} + \\setCJKmainfont{Noto Sans CJK SC}[AutoFakeSlant] } - \\setCJKsansfont{Noto Sans CJK SC} - \\setCJKmonofont{Noto Sans Mono CJK SC} + \\setCJKsansfont{Noto Sans CJK SC}[AutoFakeSlant] + \\setCJKmonofont{Noto Sans Mono CJK SC}[AutoFakeSlant] % CJK Language-specific font choices \\IfFontExistsTF{Noto Serif CJK SC}{ - \\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC} - \\newCJKfontfamily[SCserif]\\scserif{Noto Serif CJK SC} + \\newCJKfontfamily[SCmain]\\scmain{Noto Serif CJK SC}[AutoFakeSlant] + \\newCJKfontfamily[SCserif]\\scserif{Noto Serif CJK SC}[AutoFakeSlant] }{ - \\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC} - \\newCJKfontfamily[SCserif]\\scserif{Noto Sans CJK SC} + \\newCJKfontfamily[SCmain]\\scmain{Noto Sans CJK SC}[AutoFakeSlant] + \\newCJKfontfamily[SCserif]\\scserif{Noto Sans CJK SC}[AutoFakeSlant] } - \\newCJKfontfamily[SCsans]\\scsans{Noto Sans CJK SC} - \\newCJKfontfamily[SCmono]\\scmono{Noto Sans Mono CJK SC} + \\newCJKfontfamily[SCsans]\\scsans{Noto Sans CJK SC}[AutoFakeSlant] + \\newCJKfontfamily[SCmono]\\scmono{Noto Sans Mono CJK SC}[AutoFakeSlant] \\IfFontExistsTF{Noto Serif CJK TC}{ - \\newCJKfontfamily[TCmain]\\tcmain{Noto Serif CJK TC} - \\newCJKfontfamily[TCserif]\\tcserif{Noto Serif CJK TC} + \\newCJKfontfamily[TCmain]\\tcmain{Noto Serif CJK TC}[AutoFakeSlant] + \\newCJKfontfamily[TCserif]\\tcserif{Noto Serif CJK TC}[AutoFakeSlant] }{ - \\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC} - \\newCJKfontfamily[TCserif]\\tcserif{Noto Sans CJK TC} + \\newCJKfontfamily[TCmain]\\tcmain{Noto Sans CJK TC}[AutoFakeSlant] + \\newCJKfontfamily[TCserif]\\tcserif{Noto Sans CJK TC}[AutoFakeSlant] } - \\newCJKfontfamily[TCsans]\\tcsans{Noto Sans CJK TC} - \\newCJKfontfamily[TCmono]\\tcmono{Noto Sans Mono CJK TC} + \\newCJKfontfamily[TCsans]\\tcsans{Noto Sans CJK TC}[AutoFakeSlant] + \\newCJKfontfamily[TCmono]\\tcmono{Noto Sans Mono CJK TC}[AutoFakeSlant] \\IfFontExistsTF{Noto Serif CJK KR}{ - \\newCJKfontfamily[KRmain]\\krmain{Noto Serif CJK KR} - \\newCJKfontfamily[KRserif]\\krserif{Noto Serif CJK KR} + \\newCJKfontfamily[KRmain]\\krmain{Noto Serif CJK KR}[AutoFakeSlant] + \\newCJKfontfamily[KRserif]\\krserif{Noto Serif CJK KR}[AutoFakeSlant] }{ - \\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR} - \\newCJKfontfamily[KRserif]\\krserif{Noto Sans CJK KR} + \\newCJKfontfamily[KRmain]\\krmain{Noto Sans CJK KR}[AutoFakeSlant] + \\newCJKfontfamily[KRserif]\\krserif{Noto Sans CJK KR}[AutoFakeSlant] } - \\newCJKfontfamily[KRsans]\\krsans{Noto Sans CJK KR} - \\newCJKfontfamily[KRmono]\\krmono{Noto Sans Mono CJK KR} + \\newCJKfontfamily[KRsans]\\krsans{Noto Sans CJK KR}[AutoFakeSlant] + \\newCJKfontfamily[KRmono]\\krmono{Noto Sans Mono CJK KR}[AutoFakeSlant] \\IfFontExistsTF{Noto Serif CJK JP}{ - \\newCJKfontfamily[JPmain]\\jpmain{Noto Serif CJK JP} - \\newCJKfontfamily[JPserif]\\jpserif{Noto Serif CJK JP} + \\newCJKfontfamily[JPmain]\\jpmain{Noto Serif CJK JP}[AutoFakeSlant] + \\newCJKfontfamily[JPserif]\\jpserif{Noto Serif CJK JP}[AutoFakeSlant] }{ - \\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP} - \\newCJKfontfamily[JPserif]\\jpserif{Noto Sans CJK JP} + \\newCJKfontfamily[JPmain]\\jpmain{Noto Sans CJK JP}[AutoFakeSlant] + \\newCJKfontfamily[JPserif]\\jpserif{Noto Sans CJK JP}[AutoFakeSlant] } - \\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP} - \\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP} + \\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP}[AutoFakeSlant] + \\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP}[AutoFakeSlant] % Dummy commands for Sphinx < 2.3 (no 'extrapackages' support) \\providecommand{\\onehalfspacing}{} \\providecommand{\\singlespacing}{} diff --git a/Documentation/translations/conf.py b/Documentation/translations/conf.py index e859c2e19e8bc9..92cdbba7422997 100644 --- a/Documentation/translations/conf.py +++ b/Documentation/translations/conf.py @@ -7,6 +7,6 @@ latex_elements['preamble'] += ''' \\IfFontExistsTF{Noto Sans CJK SC}{ % For CJK ascii-art alignment - \\setmonofont{Noto Sans Mono CJK SC} + \\setmonofont{Noto Sans Mono CJK SC}[AutoFakeSlant] }{} ''' -- cgit 1.2.3-korg From 29ac9822358f0680e4020a15dcfea1c76011e872 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Mon, 9 Aug 2021 10:27:18 +0900 Subject: docs: pdfdocs: Teach xeCJK about character classes of quotation marks Quotation marks in "KR" and "JP" variants of Noto CJK fonts are half width. xeCJK assumes they are full width by default and does excessive kerning around them in Korean and Japanese translations. Give xeCJK proper hints by the \xeCJKDeclareCharClass command. Signed-off-by: Akira Yokosawa Link: https://lore.kernel.org/r/0da9e3c5-2716-f576-1df5-2f28ea69f0e8@gmail.com Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/conf.py') diff --git a/Documentation/conf.py b/Documentation/conf.py index afa085c7178183..75650f6443af95 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -428,6 +428,8 @@ latex_elements['preamble'] += ''' \\newcommand{\\kerneldocEndTC}{\\endgroup} \\newcommand{\\kerneldocBeginKR}{% \\begingroup% + \\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}% + \\xeCJKDeclareCharClass{HalfRight}{`”,`’}% \\krmain% \\renewcommand{\\CJKrmdefault}{KRserif}% \\renewcommand{\\CJKsfdefault}{KRsans}% @@ -437,6 +439,8 @@ latex_elements['preamble'] += ''' \\newcommand{\\kerneldocEndKR}{\\endgroup} \\newcommand{\\kerneldocBeginJP}{% \\begingroup% + \\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}% + \\xeCJKDeclareCharClass{HalfRight}{`”,`’}% \\jpmain% \\renewcommand{\\CJKrmdefault}{JPserif}% \\renewcommand{\\CJKsfdefault}{JPsans}% -- cgit 1.2.3-korg