From c539d64d22a0fdef1bd044a6e28e02a6bcfd0adf Mon Sep 17 00:00:00 2001 From: Jacob Moody Date: Sat, 9 Jul 2022 03:43:33 +0000 Subject: [PATCH] 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. --- rc/bin/man | 13 ++++++++----- sys/man/1/ktrans | 2 ++ 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