Refs #33247 -- Fixed rendering of Unicode chars and emojis in PDF docs build.

This commit is contained in:
Andrew Neitsch 2021-10-30 15:50:12 -06:00 committed by Mariusz Felisiak
parent a934d377af
commit 95a4db3fbd
1 changed files with 28 additions and 6 deletions

View File

@ -272,13 +272,35 @@ rst_epilog = """
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output --------------------------------------------------
# Use lualatex for Unicode support.
latex_engine = 'lualatex'
# Set fonts and fallbacks for CJK and Emojis.
latex_elements = { latex_elements = {
'preamble': ( 'preamble': r"""
'\\DeclareUnicodeCharacter{2264}{\\ensuremath{\\le}}' \directlua{
'\\DeclareUnicodeCharacter{2265}{\\ensuremath{\\ge}}' luaotfload.add_fallback("seriffallbacks", {
'\\DeclareUnicodeCharacter{2665}{[unicode-heart]}' "Noto Serif CJK SC:style=Regular;",
'\\DeclareUnicodeCharacter{2713}{[unicode-checkmark]}' "Symbola:Style=Regular;"
), })
}
\setmainfont{FreeSerif}[RawFeature={fallback=seriffallbacks}]
\directlua{
luaotfload.add_fallback("sansfallbacks", {
"Noto Sans CJK SC:style=Regular;",
"Symbola:Style=Regular;"
})
}
\setsansfont{FreeSans}[RawFeature={fallback=sansfallbacks}]
\directlua{
luaotfload.add_fallback("monofallbacks", {
"Noto Sans Mono CJK SC:style=Regular;",
"Symbola:Style=Regular;"
})
}
\setmonofont{FreeMono}[RawFeature={fallback=monofallbacks}]
""",
} }
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples