9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] fmt and unicode text
@ 2003-11-16 19:29 mirtchov
  2003-11-16 21:23 ` Russ Cox
  2003-11-16 21:28 ` David Presotto
  0 siblings, 2 replies; 10+ messages in thread
From: mirtchov @ 2003-11-16 19:29 UTC (permalink / raw)
  To: 9fans

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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-11-16 23:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-16 19:29 [9fans] fmt and unicode text 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
2003-11-16 21:34   ` David Presotto
2003-11-16 21:52     ` mirtchov
2003-11-16 21:51   ` mirtchov

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