Commit 5d9158e3 authored by Akira Yokosawa's avatar Akira Yokosawa Committed by Jonathan Corbet

docs/translations: Skip CJK contents if suitable fonts not found

On systems without "Noto Sans CJK" fonts, CJK chapters in
translations.pdf are full of "TOFU" boxes, with a long build time and
a large log file containing lots of missing-font warnings.

Avoid such waste of time and resources by skipping CJK chapters when
CJK fonts are not available.

To skip whole chapters, change the definition of
\kerneldocBegin{SC|TC|KR|JP} commands so that they can have an argument
to be ignored.
This works as far as the argument (#1) is not used in the command.
In place of skipped contents, put a note on skipped contents at the
beginning of the PDF.

Change the call sites in index.rst of CJK translations accordingly.

When CJK fonts are available, existing command definitions with
no argument just work.  LaTeX engine will see additional pairs of
"{" and "}", which add a level of grouping without having any effect
on typesetting.
Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/3359ca41-b81d-b2c7-e437-7618efbe241d@gmail.comSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 7b686a2e
...@@ -563,13 +563,18 @@ latex_elements['preamble'] += ''' ...@@ -563,13 +563,18 @@ latex_elements['preamble'] += '''
% Custom macros to on/off CJK (Dummy) % Custom macros to on/off CJK (Dummy)
\\newcommand{\\kerneldocCJKon}{} \\newcommand{\\kerneldocCJKon}{}
\\newcommand{\\kerneldocCJKoff}{} \\newcommand{\\kerneldocCJKoff}{}
\\newcommand{\\kerneldocBeginSC}{} \\newcommand{\\kerneldocBeginSC}[1]{%
\\begin{sphinxadmonition}{note}{Note:}
``Noto Sans CJK'' fonts are not found while building this PDF\\@.
Translations of zh\\_CN, zh\\_TW, ko\\_KR, and ja\\_JP are
skipped.
\\end{sphinxadmonition}}
\\newcommand{\\kerneldocEndSC}{} \\newcommand{\\kerneldocEndSC}{}
\\newcommand{\\kerneldocBeginTC}{} \\newcommand{\\kerneldocBeginTC}[1]{}
\\newcommand{\\kerneldocEndTC}{} \\newcommand{\\kerneldocEndTC}{}
\\newcommand{\\kerneldocBeginKR}{} \\newcommand{\\kerneldocBeginKR}[1]{}
\\newcommand{\\kerneldocEndKR}{} \\newcommand{\\kerneldocEndKR}{}
\\newcommand{\\kerneldocBeginJP}{} \\newcommand{\\kerneldocBeginJP}[1]{}
\\newcommand{\\kerneldocEndJP}{} \\newcommand{\\kerneldocEndJP}{}
} }
''' '''
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\renewcommand\thesection* \renewcommand\thesection*
\renewcommand\thesubsection* \renewcommand\thesubsection*
\kerneldocCJKon \kerneldocCJKon
\kerneldocBeginJP \kerneldocBeginJP{
Japanese translations Japanese translations
===================== =====================
...@@ -15,4 +15,4 @@ Japanese translations ...@@ -15,4 +15,4 @@ Japanese translations
.. raw:: latex .. raw:: latex
\kerneldocEndJP }\kerneldocEndJP
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\renewcommand\thesection* \renewcommand\thesection*
\renewcommand\thesubsection* \renewcommand\thesubsection*
\kerneldocCJKon \kerneldocCJKon
\kerneldocBeginKR \kerneldocBeginKR{
한국어 번역 한국어 번역
=========== ===========
...@@ -26,5 +26,4 @@ ...@@ -26,5 +26,4 @@
.. raw:: latex .. raw:: latex
\normalsize }\kerneldocEndKR
\kerneldocEndKR
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\renewcommand\thesection* \renewcommand\thesection*
\renewcommand\thesubsection* \renewcommand\thesubsection*
\kerneldocCJKon \kerneldocCJKon
\kerneldocBeginSC \kerneldocBeginSC{
.. _linux_doc_zh: .. _linux_doc_zh:
...@@ -198,4 +198,4 @@ TODOList: ...@@ -198,4 +198,4 @@ TODOList:
.. raw:: latex .. raw:: latex
\kerneldocEndSC }\kerneldocEndSC
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\renewcommand\thesection* \renewcommand\thesection*
\renewcommand\thesubsection* \renewcommand\thesubsection*
\kerneldocCJKon \kerneldocCJKon
\kerneldocBeginTC \kerneldocBeginTC{
.. _linux_doc_zh_tw: .. _linux_doc_zh_tw:
...@@ -174,4 +174,4 @@ TODOList: ...@@ -174,4 +174,4 @@ TODOList:
.. raw:: latex .. raw:: latex
\kerneldocEndTC }\kerneldocEndTC
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