LINE BREAKING ALGORITHM FOR MINIMIZING THE APPEARANCE OF RAGS AND RIVERS IN TEXT ALIGNMENT: LEFT ALIGNED, CENTER ALIGNED, RIGHT ALIGNED, AND JUSTIFIED - Alhadi Ramadhani, Aditya
This Final Project aims to optimize the line breaking algorithm to achieve better text layout and aesthetics in applications such as typography and graphic design. Line breaking plays an important role in determining the distribution of text across lines so as to minimize visual distractions such as rags and rivers. The level of rags represents the balance of row length, while the number of rivers measures the occurrence of visually distracting space gaps. Here we focus on three line breaking algorithms, namely Line-by-line, Dynamic Programming-1, and Dynamic Programming-2. Each algorithm is evaluated based on its ability to minimize the appearance of rags and rivers. The analysis is carried out for three type of given text alignment: left (right) aligned, center aligned, and justified (left-right aligned). The sample used to evaluate each algorithm is Lorem Ipsum which consists of 104 words with line lengths of 81, 77, and 83. These line lengths were chosen because at line length ranges of 45—90, the Line-by-line, Dynamic Programming-1, and Dynamic Programming-2 line breaking algorithms have the lowest minimum cost values at line lengths of 81, 77, and 83, respectively.