9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Presotto <presotto@closedmind.org>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] fmt and unicode text
Date: Sun, 16 Nov 2003 16:28:45 -0500	[thread overview]
Message-ID: <44f445f990c9d739081500c810f292d5@plan9.bell-labs.com> (raw)
In-Reply-To: <6a245736ff4fa6f1dcf7d9b2303482bd@plan9.ucalgary.ca>

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

Odd, of the two examples, the old fmt looks reasonable on my screen
and the other has odd long and unbalanced line.  What is the
advantage here?

[-- Attachment #2: Type: message/rfc822, Size: 3992 bytes --]

From: mirtchov@cpsc.ucalgary.ca
To: 9fans@cse.psu.edu
Subject: [9fans] fmt and unicode text
Date: Sun, 16 Nov 2003 12:29:24 -0700
Message-ID: <6a245736ff4fa6f1dcf7d9b2303482bd@plan9.ucalgary.ca>

This diff makes 'fmt' understand utf text without cutting it short:

	home% diff fmt.c /sys/src/cmd/fmt.c
	197c197
	< 			col += utflen(w[i]->text);
	---
	> 			col += strlen(w[i]->text);
	203c203
	< 			if(col+nsp+utflen(w[i]->text) > extraindent+length)
	---
	> 			if(col+nsp+strlen(w[i]->text) > extraindent+length)
	home% 


here's an example:

This is utf text formatted with the stock fmt:

  Зарегистрируйтесь сейчас на Десятую
  Международную Конференцию по Unicode,
  которая состоится 10-12 марта 1997 года в
  Майнце в Германии.  

This is utf text formatted with the new fmt:

  Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
  Unicode, которая состоится 10-12 марта 1997 года в Майнце в
  Германии.  

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..
  
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.

  parent reply	other threads:[~2003-11-16 21:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-16 19:29 mirtchov
2003-11-16 21:23 ` Russ Cox
2003-11-16 21:51   ` mirtchov
2003-11-16 22:22     ` Russ Cox
2003-11-16 23:22       ` Lyndon Nerenberg
2003-11-16 23:39         ` Russ Cox
2003-11-16 21:28 ` David Presotto [this message]
2003-11-16 21:34   ` David Presotto
2003-11-16 21:52     ` mirtchov
2003-11-16 21:51   ` mirtchov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44f445f990c9d739081500c810f292d5@plan9.bell-labs.com \
    --to=presotto@closedmind.org \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).