summaryrefslogtreecommitdiff
path: root/rc
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 /rc
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.
Diffstat (limited to 'rc')
-rwxr-xr-xrc/bin/man13
1 files changed, 8 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
}