From: Akira Yokosawa <akiyks@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "Wu X.C." <bobwxc@email.cn>, SeongJae Park <sj38.park@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Akira Yokosawa <akiyks@gmail.com>
Subject: [RFC PATCH 2/3] docs: pdfdocs: Add font settings for CJK ascii-art
Date: Thu, 24 Jun 2021 21:11:28 +0900 [thread overview]
Message-ID: <c1dd4761-2c6e-9b99-f963-8d0d80142db3@gmail.com> (raw)
In-Reply-To: <386938dc-6290-239c-4b4f-c6153f3d98c5@gmail.com>
This is irrelevant to those who don't care translations docs.
Current font choice of "DejaVu Sans Mono" and "Noto Sans CJK SC" for
monospace fonts generates misaligned ascii-art figures in translations.
Using "Noto Sans Mono CJK SC" for both the monofont and CJKmonofont
choices is a better option.
As for Korean translation, there remain character width mismatches.
Hangul characters in "Noto Sans Mono CJK SC" are slightly narrower than
Chinese and Japanese characters, despite the "Mono" in the font name.
This results in mis-aligned ascii-art figures in Korean translation
of memory-barriers.txt.
Proper width Hangul characters are available in "Unifont", although with
degraded look of CJK characters due to Unifont's bitmap-font nature.
So "Unifont" is used only when it is found on the system.
Note 1: Unifont can be installed by:
(Ubuntu) apt-get install ttf-unifont
(Fedora) dnf install unifont-fonts
Note 2: Let us know if there is a better monospace font choice for Hangul.
Note 3: Sphinx itself is confused by tabs behind CJK characters. Korean
translation of memory-barriers.txt needs a couple of fixes to this
effect, of which a follow up change takes care.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Documentation/conf.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 22f083bafaae..a95bd2123da1 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -363,12 +363,19 @@ latex_elements['preamble'] += '''
% This is needed for translations
\\usepackage{xeCJK}
\\setCJKmainfont{Noto Sans CJK SC}
+ \\setCJKsansfont{Noto Sans CJK SC}
+ \\setCJKmonofont{Noto Sans Mono CJK SC}
+ \\setmonofont{Noto Sans Mono CJK SC}
% Define custom macros to on/off CJK
\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
% Inactivate CJK after tableofcontents (using etoolbox)
\\usepackage{etoolbox}
\\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{}
+ \\IfFontExistsTF{Unifont}{
+ % For alinged Korean ascii-art
+ \\setCJKmonofont{Unifont}
+ }{}
}{ % No CJK font
% Custom macros to on/off CJK (Dummy)
\\newcommand{\\kerneldocCJKon}{}
--
2.17.1
next prev parent reply other threads:[~2021-06-24 12:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 12:06 [RFC PATCH 0/3] docs: pdfdocs: Improve alignment of " Akira Yokosawa
2021-06-24 12:08 ` [RFC PATCH 1/3] docs: pdfdocs: Refactor config for CJK document Akira Yokosawa
2021-06-24 12:11 ` Akira Yokosawa [this message]
2021-06-24 12:14 ` [RFC PATCH 3/3] docs: ko_KR: Use white spaces behind CJK characters in ascii-art Akira Yokosawa
2021-06-24 12:59 ` [RFC PATCH 0/3] docs: pdfdocs: Improve alignment of CJK ascii-art Mauro Carvalho Chehab
2021-06-25 6:55 ` Wu X.C.
2021-06-25 7:50 ` Mauro Carvalho Chehab
2021-06-25 9:22 ` Akira Yokosawa
2021-06-25 10:24 ` Mauro Carvalho Chehab
2021-06-25 11:32 ` Akira Yokosawa
2021-06-25 17:17 ` Wu X.C.
2021-06-25 18:11 ` Mauro Carvalho Chehab
2021-06-26 2:32 ` Akira Yokosawa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1dd4761-2c6e-9b99-f963-8d0d80142db3@gmail.com \
--to=akiyks@gmail.com \
--cc=bobwxc@email.cn \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sj38.park@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®