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.
This commit is contained in:
Jacob Moody 2022-07-09 03:43:33 +00:00
parent 566c512106
commit c539d64d22
2 changed files with 10 additions and 5 deletions

View file

@ -11,6 +11,7 @@ d=0
fn roff { fn roff {
preproc=() preproc=()
Jpflag=()
postproc=cat postproc=cat
x=`{doctype $2} x=`{doctype $2}
if (~ $1 t) { if (~ $1 t) {
@ -19,6 +20,8 @@ fn roff {
if(~ $x *pic*) if(~ $x *pic*)
preproc=($preproc pic) preproc=($preproc pic)
Nflag=-Tutf Nflag=-Tutf
if(grep -s '^.ft Jp|\f\[Jp\]' $2)
Jpflag='-mnihongo'
} }
if not { if not {
Nflag='-N' Nflag='-N'
@ -34,17 +37,17 @@ fn roff {
{echo -n $FONTS; cat $2 </dev/null} | {echo -n $FONTS; cat $2 </dev/null} |
switch($#preproc) { switch($#preproc) {
case 0 case 0
troff $Nflag $Lflag -$MAN troff $Nflag $Lflag -$MAN $Jpflag
case 1 case 1
$preproc | troff $Nflag $Lflag -$MAN $preproc | troff $Nflag $Lflag -$MAN $Jpflag
case 2 case 2
$preproc(1) | $preproc(2) | troff $Nflag $Lflag -$MAN $preproc(1) | $preproc(2) | troff $Nflag $Lflag -$MAN $Jpflag
case 3 case 3
$preproc(1) | $preproc(2) | $preproc(3) | $preproc(1) | $preproc(2) | $preproc(3) |
troff $Nflag $Lflag -$MAN troff $Nflag $Lflag -$MAN $Jpflag
case * case *
$preproc(1) | $preproc(2) | $preproc(3) | $preproc(1) | $preproc(2) | $preproc(3) |
$preproc(4) | troff $Nflag $Lflag -$MAN $preproc(4) | troff $Nflag $Lflag -$MAN $Jpflag
} | $postproc } | $postproc
} }

View file

@ -86,8 +86,10 @@ or run it with a sub-rio on a window like:
.SH EXAMPLES .SH EXAMPLES
If you want to make the Japanese text as below: If you want to make the Japanese text as below:
.ft Jp
私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。 私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
健康の維持にも役だっていますが、 なかなかたのしいものです。 健康の維持にも役だっていますが、 なかなかたのしいものです。
.ft
your keyboard typing stream should be: your keyboard typing stream should be: