From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <6a245736ff4fa6f1dcf7d9b2303482bd@plan9.ucalgary.ca> To: 9fans@cse.psu.edu From: mirtchov@cpsc.ucalgary.ca MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Subject: [9fans] fmt and unicode text Date: Sun, 16 Nov 2003 12:29:24 -0700 Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: 8b25beb6-eacc-11e9-9e20-41e7f4b1d025 This diff makes 'fmt' understand utf text without cutting it short: home% diff fmt.c /sys/src/cmd/fmt.c 197c197 < col +=3D utflen(w[i]->text); --- > col +=3D strlen(w[i]->text); 203c203 < if(col+nsp+utflen(w[i]->text) > extraindent+length) --- > if(col+nsp+strlen(w[i]->text) > extraindent+length) home%=20 here's an example: This is utf text formatted with the stock fmt: =D0=97=D0=B0=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B8=D1=80=D1=83= =D0=B9=D1=82=D0=B5=D1=81=D1=8C =D1=81=D0=B5=D0=B9=D1=87=D0=B0=D1=81 =D0=BD= =D0=B0 =D0=94=D0=B5=D1=81=D1=8F=D1=82=D1=83=D1=8E =D0=9C=D0=B5=D0=B6=D0=B4=D1=83=D0=BD=D0=B0=D1=80=D0=BE=D0=B4=D0=BD=D1=83= =D1=8E =D0=9A=D0=BE=D0=BD=D1=84=D0=B5=D1=80=D0=B5=D0=BD=D1=86=D0=B8=D1=8E= =D0=BF=D0=BE Unicode, =D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=B0=D1=8F =D1=81=D0=BE=D1=81=D1=82=D0=BE= =D0=B8=D1=82=D1=81=D1=8F 10-12 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 1997 =D0=B3= =D0=BE=D0=B4=D0=B0 =D0=B2 =D0=9C=D0=B0=D0=B9=D0=BD=D1=86=D0=B5 =D0=B2 =D0=93=D0=B5=D1=80=D0=BC=D0= =B0=D0=BD=D0=B8=D0=B8. =20 This is utf text formatted with the new fmt: =D0=97=D0=B0=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B8=D1=80=D1=83= =D0=B9=D1=82=D0=B5=D1=81=D1=8C =D1=81=D0=B5=D0=B9=D1=87=D0=B0=D1=81 =D0=BD= =D0=B0 =D0=94=D0=B5=D1=81=D1=8F=D1=82=D1=83=D1=8E =D0=9C=D0=B5=D0=B6=D0=B4= =D1=83=D0=BD=D0=B0=D1=80=D0=BE=D0=B4=D0=BD=D1=83=D1=8E =D0=9A=D0=BE=D0=BD= =D1=84=D0=B5=D1=80=D0=B5=D0=BD=D1=86=D0=B8=D1=8E =D0=BF=D0=BE Unicode, =D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=B0=D1=8F =D1=81=D0=BE=D1=81=D1= =82=D0=BE=D0=B8=D1=82=D1=81=D1=8F 10-12 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 19= 97 =D0=B3=D0=BE=D0=B4=D0=B0 =D0=B2 =D0=9C=D0=B0=D0=B9=D0=BD=D1=86=D0=B5 =D0= =B2 =D0=93=D0=B5=D1=80=D0=BC=D0=B0=D0=BD=D0=B8=D0=B8. =20 Note that the russian text above appears to be formatted longer than this english text. That is due to the default cyrillic fonts being used in acme rendered slightly larger, even the fixed-size ones. If you use something completely fixed-size such as /lib/font/bit/10646/7x13/7x13.font you'll find that the texts are of proper length :) cheers, andrey ps: the patch(1) system isn't operational still.. =20 pps: a similar change may be required for cb(1), but since most code is written in plain english I doubt it's that necessary.