summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJean-François B <2589111+jfbu@users.noreply.github.com>2023-01-05 14:01:42 +0100
committerJean-François B <2589111+jfbu@users.noreply.github.com>2023-02-07 21:27:17 +0100
commitef55d645d27c593d0c92a1dfbfb37485fcd8a50b (patch)
tree7fb0cf2c1ff9f428d1c1356ff6ba169c3873a044 /doc
parent8ace612c3b1bbf0bd23f10556492908afdc97207 (diff)
downloadnumpy-ef55d645d27c593d0c92a1dfbfb37485fcd8a50b.tar.gz
DOC: LaTeX: Use FandolSong-Regular OpenType font for Chinese characters
Unfortunately, there is no mechanism provided by (Xe)LaTeX to automatically fall-back on some rescue font when the main document font does not support a character. But one can configure each problematic character to use a specific font, and the FandolSong font from TeXLive-based LaTeX distributions provides for all currently needed such problematic characters. Close: #22930
Diffstat (limited to 'doc')
-rw-r--r--doc/source/conf.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 121973138..ed5c11781 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -258,6 +258,17 @@ latex_elements = {
# Additional stuff for the LaTeX preamble.
latex_elements['preamble'] = r'''
+\newfontfamily\FontForChinese{FandolSong-Regular}[Extension=.otf]
+\catcode`琴\active\protected\def琴{{\FontForChinese\string琴}}
+\catcode`春\active\protected\def春{{\FontForChinese\string春}}
+\catcode`鈴\active\protected\def鈴{{\FontForChinese\string鈴}}
+\catcode`猫\active\protected\def猫{{\FontForChinese\string猫}}
+\catcode`傅\active\protected\def傅{{\FontForChinese\string傅}}
+\catcode`立\active\protected\def立{{\FontForChinese\string立}}
+\catcode`业\active\protected\def业{{\FontForChinese\string业}}
+\catcode`(\active\protected\def({{\FontForChinese\string(}}
+\catcode`)\active\protected\def){{\FontForChinese\string)}}
+
% In the parameters section, place a newline after the Parameters
% header. This is default with Sphinx 5.0.0+, so no need for
% the old hack then.