diff --git a/.readthedocs.yml b/.readthedocs.yml index 10c21fd8f..711002769 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,13 +1,15 @@ version: 2 python: - version: 3.7 install: - requirements: doc/en/requirements.txt - method: pip path: . build: + os: ubuntu-20.04 + tools: + python: "3.9" apt_packages: - inkscape diff --git a/changelog/9242.doc.rst b/changelog/9242.doc.rst new file mode 100644 index 000000000..3239cf998 --- /dev/null +++ b/changelog/9242.doc.rst @@ -0,0 +1 @@ +Upgrade readthedocs configuration to use a [newer Ubuntu version](https://blog.readthedocs.com/new-build-specification/) with better unicode support for PDF docs. diff --git a/doc/en/conf.py b/doc/en/conf.py index 51ab612ed..5b73b457c 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -19,6 +19,7 @@ import ast import os import shutil import sys +from textwrap import dedent from typing import List from typing import TYPE_CHECKING @@ -39,9 +40,22 @@ autodoc_member_order = "bysource" autodoc_typehints = "description" todo_include_todos = 1 -# Use a different latex engine due to possible Unicode characters in the documentation: -# https://docs.readthedocs.io/en/stable/guides/pdf-non-ascii-languages.html -latex_engine = "xelatex" +latex_engine = "lualatex" + +latex_elements = { + "preamble": dedent( + r""" + \directlua{ + luaotfload.add_fallback("fallbacks", { + "Noto Serif CJK SC:style=Regular;", + "Symbola:Style=Regular;" + }) + } + + \setmainfont{FreeSerif}[RawFeature={fallback=fallbacks}] + """ + ) +} # -- General configuration -----------------------------------------------------