uutils/coreutils — pull request #318 by kwantam (2014-06-27 20:18:17+00:00)
Title: fmt: Knuth-Plass implementation; common: add unicode char_width function

fmt:
- Implemented Knuth-Plass optimal linebreaking strategy.
- Added commandline switch -q for "quick" (greedy) split
mode that does not use Knuth-Plass.
- Right now, Knuth-Plass runs about half as fast as greedy.
It also inherently uses more memory.
- Updated fmt to use char_width (see below) instead of
assuming each character width is 1.
- Use i64 for demerits instead of int in K-P, since int is
pointer sized and will only be 32 bits on some
architectures.

common:
- Added a support module for computing displayed widths of unicode
strings based on Markus Kuhn's free implementation at
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
- Also added support for auto-generating the width tables based on
updated unicode charset data. This script only needs to be run when
unicode charsets are updated. There is no reason to regenerate this
during building.
- I'm hopeful that eventually this functionality will be in libcore and we
will be able to get rid of it.