CTS logo
hazy blue Catskill Mountains in distance

News:

PDF::Builder v3.027 Released, 18 April 2025
   Please also see the CPAN listing, the GitHub entry, and the latest changes list.


A Thought…

I used to date a seismologist. It was a pretty shaky relationship. It was tough because she knew about all my faults.
    — too-zonked, Doonesbury comic letters

But did the earth move for you?
    — jvo

I guess that when it comes to men, she can seism up.
    — MichaelAxelFleming

Are you claiming she subducted you?
    — Packratjohn

That’s nothing—I once dated a Quaker. She left me all shook up.
    — DavidSharp

Seismologist jokes…haven’t we suffered enough? No? Rock on!
    — well-I-never

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 – 2025 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

Sat, 18 Oct 2025 at 5:57 AM EDT