CTS logo
hazy blue Catskill Mountains in distance

Perl library for line-splitting (paragraph shaping)

Links to files and information for Text::KnuthPlass…

What is it?

Text::KnuthPlass uses the famed Knuth-Plass line-splitting algorithm (used in TeX and LaTeX) to break up a text string into a properly "shaped" paragraph. Certain rules are followed to not only efficiently pack the paragraph into a minimal number of lines, but also to minimize hyphenation, keep line density fairly constant, and take other measures to ensure that the output is typographically "nice looking". It works with both fixed-width fonts and with proportional (variable-width) fonts, where you supply the font library that calculates word lengths (e.g., PDF::Builder's advancewidth() method). Text::KnuthPlass permits varying line lengths, to allow text to flow around other objects, such as illustrations. It also makes use of (by default) Text::Hyphen, a library to indicate where words can be split (for hyphenation purposes).

See also this blog on Paragraph Shaping for a deeper dive into the subject.

 

All content © copyright 2005 – 2024 by Catskill Technology Services, LLC.
All rights reserved.
Note that Third Party software (whether Open Source or proprietary) on this site remains under the copyright and license of its owners. Catskill Technology Services, LLC does not claim copyright over such software.

 

This page is https://www.catskilltech.com/FreeSW/product/Text-KnuthPlass/title/Text%3A%3AKnuthPlass/freeSW_full

Search Quotations database.

Last updated Sat, 08 Apr 2023 at 3:14 PM

Valid HTML 5

Tue, 12 Nov 2024 at 4:43 AM EST