Home    All Articles    About    carlos@bueno.org    RSS

Sweet Justice: justified text for the web

23 April 2010

Sweet Justice is a Javascript library you can drop onto any web page to create beautiful justified text. Even supercalifragilisticexpealadocious.

Sweet Justice lovingly inserts the obscure yet wonderful soft hyphen into the text of any element marked with the sweet-justice class, and turns on CSS text justification. It requires either jQuery or YUI3 to function.

   - Carlos

From Wikipedia: Justification has been the preferred setting of type in many western languages through the history of movable type. This is due to the classic Western manuscript book page being built of a column or two columns, which is considered to look "best" if it is even-margined on the left and right. The classical Western column did not rigorously justify, but came as close as feasible when the skill of the penman and the character of the manuscript permitted. Historically, both scribal and typesetting traditions took advantage of abbreviations (sigla), ligatures, and swash to help maintain the rhythm and colour of a justified line.

The use of movable type solidified this preference from a technological point of view. It was much easier to handle and make emendations to large amounts of type that had words or syllables at the ends of lines than it was to respace the ends of lines.

Its use has only waned somewhat since the middle of the 20th century through the advocacy of the typographer Jan Tschichold's book Asymmetric Typography and the freer typographic treatment of the Bauhaus, Dada, and Russian constructivist movements.

Not all "flush left" settings in traditional typography were identical. In flush left text, words are separated on a line by the minimum word spacing built into the font.

Continuous casting typesetting systems such as the Linotype were able to reduce the jaggedness of the right-hand sides of adjacent lines of flush left composition by inserting self-adjusting space bands between words to evenly distribute white space, taking excessive space that would have occurred at the end of the line and redistributing it between words.

This feature, known as "ragged right" or "in and out ragged", was available in traditional dedicated typesetting systems but is absent from most if not all desktop publishing systems. Graphic designers and typesetters using desktop systems adjust word and letter spacing, or "tracking", on a manual line-by-line basis to achieve the same effect.