[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5eccdd8-8172-6dc0-c412-4d7655bd26cc@gmail.com>
Date: Mon, 19 Jul 2021 20:17:06 +0900
From: Akira Yokosawa <akiyks@...il.com>
To: Jonathan Corbet <corbet@....net>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
"Wu X.C." <bobwxc@...il.cn>, SeongJae Park <sj38.park@...il.com>
Cc: Hu Haowen <src.res@...il.cn>,
Shinwoo Lee <shinwoo.lee.us@...il.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Akira Yokosawa <akiyks@...il.com>
Subject: [RFC PATCH v2 6/7] docs: pdfdocs: Add optional choices for Korean
monospace font
Candidates of alternative choices of a *true* monospace font would
be "D2Coding", "Sarasa Mono K", or "Unifont" font.
The alignment of Korean ascii-art figures matters when the optional
conf.py under Dodumentation/translations/ is effective.
So, add conditional settings in the local config so that when one of
the candidate fonts is found, it is used instead of "Noto Sans Mono
CJK KR".
As xeCJK does not provide a macro to redefine an existing CJK font
family, define a wrapper macro "\setKRmono" and use it in the
"\kerneldocBeginKR" macro.
Also mention the nice-to-have monospace Hangul fonts in the header
comment in conf.py.
Signed-off-by: Akira Yokosawa <akiyks@...il.com>
---
Documentation/conf.py | 4 +++-
Documentation/translations/conf.py | 34 +++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 8a715765dada..1368c64e3993 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -382,6 +382,8 @@ latex_elements['preamble'] += '''
\\scserif%
}
\\newcommand{\\kerneldocEndSC}{\\endgroup}
+ \\newcommand{\\setKRmono}{% For alternative Hangul monospace font
+ \\renewcommand{\\CJKttdefault}{KRmono}}
\\newcommand{\\kerneldocBeginKR}{%
\\begingroup%
\\xeCJKDeclareCharClass{HalfLeft}{`“,`‘}%
@@ -389,7 +391,7 @@ latex_elements['preamble'] += '''
\\krserif%
\\renewcommand{\\CJKrmdefault}{KRserif}%
\\renewcommand{\\CJKsfdefault}{KRsans}%
- \\renewcommand{\\CJKttdefault}{KRmono}%
+ \\setKRmono%
\\xeCJKsetup{CJKspace = true} % For inter-phrase space
}
\\newcommand{\\kerneldocEndKR}{\\endgroup}
diff --git a/Documentation/translations/conf.py b/Documentation/translations/conf.py
index 92cdbba74229..0e171eed1862 100644
--- a/Documentation/translations/conf.py
+++ b/Documentation/translations/conf.py
@@ -3,10 +3,42 @@
# -- Additinal options for LaTeX output ----------------------------------
# font config for ascii-art alignment
-
+#
+# Note: Ascii-art figures involving Hangul characters need optional
+# monospace font. (Hangul in "Noto Sans Mono CJK" is slightly narrow.)
+# If you'd like to see properly aligned ascii-art figures in Korean
+# translations, you need to install a *true* monospace Hangul font.
+#
+# Candidates of such a monospace font which covers Hangul:
+# 1) D2Coding: Availabe at
+# https://github.com/naver/d2codingfont/releases/latest
+# 2) Sarasa Mono K: Available at
+# https://github.com/be5invis/Sarasa-Gothic/releases/latest
+# 3) Unifont: (easy to install but poor quality)
+# Available as distro packages, e.g.:
+# Ubuntu/Debian: ttf-unifont
+# Fedora: unifont-fonts
+#
latex_elements['preamble'] += '''
\\IfFontExistsTF{Noto Sans CJK SC}{
% For CJK ascii-art alignment
\\setmonofont{Noto Sans Mono CJK SC}[AutoFakeSlant]
+ \\IfFontExistsTF{D2Coding}{
+ \\newCJKfontfamily[KRtruemono]\\krtruemono{D2Coding}[AutoFakeSlant]
+ \\renewcommand{\\setKRmono}{%
+ \\renewcommand{\\CJKttdefault}{KRtruemono}}
+ }{
+ \\IfFontExistsTF{Sarasa Mono K}{
+ \\newCJKfontfamily[KRtruemono]\\krtruemono{Sarasa Mono K}
+ \\renewcommand{\\setKRmono}{%
+ \\renewcommand{\\CJKttdefault}{KRtruemono}}
+ }{
+ \\IfFontExistsTF{Unifont}{
+ \\newCJKfontfamily[KRtruemono]\\krtruemono{Unifont}[AutoFakeSlant,AutoFakeBold]
+ \\renewcommand{\\setKRmono}{%
+ \\renewcommand{\\CJKttdefault}{KRtruemono}}
+ }{}
+ }
+ }
}{}
'''
--
2.17.1
Powered by blists - more mailing lists