summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-07-09 03:43:33 +0000
committerJacob Moody <moody@posixcafe.org>2022-07-09 03:43:33 +0000
commitc539d64d22a0fdef1bd044a6e28e02a6bcfd0adf (patch)
treea5db18545d696b85703f21cf00e382a1230fbcf6
parent566c5121064c4872fd9b21bfa37b1f997d779f18 (diff)
man: turn on troff -mnihongo if JP font is used
This specifically fixes % man -P ktrans We dont have font widths for kanji in our troff font files, so we can use aux/mnihongo to render the character using libdraw, and grab the bitmap from there. It's not pretty, but aux/mnihongo exists so lets at least use it. This also updates /sys/man/1/ktrans to specify the Jp font to comply with aux/mnihongo.
-rwxr-xr-xrc/bin/man13
-rw-r--r--sys/man/1/ktrans2
2 files changed, 10 insertions, 5 deletions
diff --git a/rc/bin/man b/rc/bin/man
index f002c2121..086163f1a 100755
--- a/rc/bin/man
+++ b/rc/bin/man
@@ -11,6 +11,7 @@ d=0
fn roff {
preproc=()
+ Jpflag=()
postproc=cat
x=`{doctype $2}
if (~ $1 t) {
@@ -19,6 +20,8 @@ fn roff {
if(~ $x *pic*)
preproc=($preproc pic)
Nflag=-Tutf
+ if(grep -s '^.ft Jp|\f\[Jp\]' $2)
+ Jpflag='-mnihongo'
}
if not {
Nflag='-N'
@@ -34,17 +37,17 @@ fn roff {
{echo -n $FONTS; cat $2 </dev/null} |
switch($#preproc) {
case 0
- troff $Nflag $Lflag -$MAN
+ troff $Nflag $Lflag -$MAN $Jpflag
case 1
- $preproc | troff $Nflag $Lflag -$MAN
+ $preproc | troff $Nflag $Lflag -$MAN $Jpflag
case 2
- $preproc(1) | $preproc(2) | troff $Nflag $Lflag -$MAN
+ $preproc(1) | $preproc(2) | troff $Nflag $Lflag -$MAN $Jpflag
case 3
$preproc(1) | $preproc(2) | $preproc(3) |
- troff $Nflag $Lflag -$MAN
+ troff $Nflag $Lflag -$MAN $Jpflag
case *
$preproc(1) | $preproc(2) | $preproc(3) |
- $preproc(4) | troff $Nflag $Lflag -$MAN
+ $preproc(4) | troff $Nflag $Lflag -$MAN $Jpflag
} | $postproc
}
diff --git a/sys/man/1/ktrans b/sys/man/1/ktrans
index 2b1cd7e84..6e3ba6af1 100644
--- a/sys/man/1/ktrans
+++ b/sys/man/1/ktrans
@@ -86,8 +86,10 @@ or run it with a sub-rio on a window like:
.SH EXAMPLES
If you want to make the Japanese text as below:
+.ft Jp
私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
健康の維持にも役だっていますが、 なかなかたのしいものです。
+.ft
your keyboard typing stream should be: