Skip to content

Commit

Permalink
ci: use source han sans for pdf docs in readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
blueset committed Mar 19, 2020
1 parent 9c22fc3 commit dbb959a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# Required
version: 2

build:
image: latest

This comment has been minimized.

Copy link
@humitos

humitos Mar 19, 2020

Here it should say testing to use the testing image that includes the new fonts.


# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
Expand Down
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,5 +400,13 @@ def setup(self):
self.config.overrides['language'] = conversion.get(self.config.overrides.get('language', None),
self.config.overrides.get('language', None))
if self.config.language and self.config.language.startswith("zh"):
self.config.latex_elements['fontpkg'] = r"\usepackage{xeCJK}"
self.config.latex_elements['fontpkg'] = r"""
\usepackage[AutoFallBack=true]{xeCJK}
\setCJKmainfont{Noto Serif CJK SC}[Language=Chinese Simplified, BoldFont={* Bold}, ItalicFont=AR PL KaitiM GB]
\setCJKsansfont{Noto Sans CJK SC}[Language=Chinese Simplified, BoldFont={* Bold}, ItalicFont=AR PL KaitiM GB]
\setCJKmonofont{Noto Sans CJK SC}[Language=Chinese Simplified, BoldFont={* Bold}, ItalicFont=AR PL KaitiM GB]
\setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeBold]{{HanaMinA},{HanaMinB}}
\setCJKfallbackfamilyfont{\CJKsfdefault}[AutoFakeBold]{{HanaMinA},{HanaMinB}}
\setCJKfallbackfamilyfont{\CJKttdefault}[AutoFakeBold]{{HanaMinA},{HanaMinB}}
"""
smartchars.quotes['zh-cn'] = smartchars.quotes['zh-tw']

0 comments on commit dbb959a

Please sign in to comment.