Skip to content

Commit

Permalink
docs: pdfdocs: Add conf.py local to translations for ascii-art alignment
Browse files Browse the repository at this point in the history
Globally choosing "Noto Sans Mono CJK SC" would result in sub-optimal look
of literal blocks in Latin documents.
Therefore, localize the font choice to translations by adding conf.py under
Documentation/translations/.

The local conf.py is enabled when the command:

    make SPHINXDIRS=translations pdfdocs

is used to build the PDF.
Resulting translations.pdf (under Documentation/output/translations/pdf)
will have properly aligned ascii-art figures.

NOTE: There remain mis-aligned ascii-art figures in Korean translations.
This is due to the font designer's decision to assign slightly narrower
widths (920) to Hangul characters in "Noto Sans Mono CJK KR" than those
of Hanja (Hanzi/Kanji) characters (1000) [1].

[1]: https://github.com/googlefonts/noto-cjk/issues/17

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Link: https://lore.kernel.org/r/79a876fc-a552-f972-4a1b-c6df4cbb36dd@gmail.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Akira Yokosawa authored and Jonathan Corbet committed Aug 12, 2021
1 parent 3538296 commit a90dad8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Documentation/translations/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: GPL-2.0

# -- Additinal options for LaTeX output ----------------------------------
# font config for ascii-art alignment

latex_elements['preamble'] += '''
\\IfFontExistsTF{Noto Sans CJK SC}{
% For CJK ascii-art alignment
\\setmonofont{Noto Sans Mono CJK SC}
}{}
'''

0 comments on commit a90dad8

Please sign in to comment.