[Sigia-l] text justification

Paul Ford ford at ftrain.com
Fri Apr 9 14:00:31 EDT 2004


Pabini Gabriel-Petit wrote:

> This is excellent data for print media, Fred, but that first result
> would differ for online text. People have difficulty with justified
> text online, because it doesn't render very well. Maybe someday it
> will be better.

A recent weblog post on Clagnut is helpful in clarifying the issues
related to justification, soft hyphens, and the like:

http://www.clagnut.com/blog/329/

CSS3 should offer some relief, when browser vendors implement it
fully.

Those who want a geeky explanation of auto-hyphenation, which is
necessary to justification, should check out The TeXBook
(http://www.cs.vu.nl/~norbert/texbook.pdf [2.5M]), which has an
appendix describing Liang's amazing hyphenation algorithm.

As pointed out in the comments of the Clagnut post, one possibility
for those wanting to hyphenate now would be a JavaScript
implementation of this algorithm. If the browser was identified as one
that properly managed soft hyphens (IE, Opera, and future versions of
Safari), the script could apply the Liang algorithm to all words
inside of text nodes in an HTML page, adding soft hyphens, and the
browser would be able to handle the rest. 

It's a fairly zippy algorithm, so on most pages it shouldn't slow
things down too much (very long pages would be a different story). The
standard TeX hyphenation dictionary is several kb, though, and would
have to be sent over inside a JavaScript array--which would add to
download times, and given that hyphenation will eventually be part of
CSS3, the JavaScript approach is probably more trouble than it's
worth.

Best,

Paul


--
paul ford // words: http://ftrain.com // work: http://copywire.com



More information about the Sigia-l mailing list