|
70 | 70 |
|
71 | 71 | % Translations have Asian (CJK) characters which are only displayed if
|
72 | 72 | % xeCJK is used
|
| 73 | +\usepackage{ifthen} |
| 74 | +\newboolean{enablecjk} |
| 75 | +\setboolean{enablecjk}{false} |
73 | 76 | \IfFontExistsTF{Noto Sans CJK SC}{
|
74 |
| - % Load xeCJK when CJK font is available |
| 77 | + \IfFileExists{xeCJK.sty}{ |
| 78 | + \setboolean{enablecjk}{true} |
| 79 | + }{} |
| 80 | +}{} |
| 81 | +\ifthenelse{\boolean{enablecjk}}{ |
| 82 | + % Load xeCJK when both the Noto Sans CJK font and xeCJK.sty are available. |
75 | 83 | \usepackage{xeCJK}
|
76 | 84 | % Noto CJK fonts don't provide slant shape. [AutoFakeSlant] permits
|
77 | 85 | % its emulation.
|
|
196 | 204 | % Inactivate CJK after tableofcontents
|
197 | 205 | \apptocmd{\sphinxtableofcontents}{\kerneldocCJKoff}{}{}
|
198 | 206 | \xeCJKsetup{CJKspace = true}% For inter-phrase space of Korean TOC
|
199 |
| -}{ % No CJK font found |
| 207 | +}{ % Don't enable CJK |
200 | 208 | % Custom macros to on/off CJK and switch CJK fonts (Dummy)
|
201 | 209 | \newcommand{\kerneldocCJKon}{}
|
202 | 210 | \newcommand{\kerneldocCJKoff}{}
|
203 | 211 | %% By defining \kerneldocBegin(SC|TC|KR|JP) as commands with an argument
|
204 | 212 | %% and ignore the argument (#1) in their definitions, whole contents of
|
205 | 213 | %% CJK chapters can be ignored.
|
206 | 214 | \newcommand{\kerneldocBeginSC}[1]{%
|
207 |
| - %% Put a note on missing CJK fonts in place of zh_CN translation. |
208 |
| - \begin{sphinxadmonition}{note}{Note on missing fonts:} |
| 215 | + %% Put a note on missing CJK fonts or the xecjk package in place of |
| 216 | + %% zh_CN translation. |
| 217 | + \begin{sphinxadmonition}{note}{Note on missing fonts and a package:} |
209 | 218 | Translations of Simplified Chinese (zh\_CN), Traditional Chinese
|
210 | 219 | (zh\_TW), Korean (ko\_KR), and Japanese (ja\_JP) were skipped
|
211 |
| - due to the lack of suitable font families. |
| 220 | + due to the lack of suitable font families and/or the texlive-xecjk |
| 221 | + package. |
212 | 222 |
|
213 | 223 | If you want them, please install ``Noto Sans CJK'' font families
|
214 |
| - by following instructions from |
| 224 | + along with the texlive-xecjk package by following instructions from |
215 | 225 | \sphinxcode{./scripts/sphinx-pre-install}.
|
216 | 226 | Having optional ``Noto Serif CJK'' font families will improve
|
217 | 227 | the looks of those translations.
|
|
0 commit comments