adelton

BGP: Box, glue, penalty

Main part of my diploma work consisted of module BGP.pm, that implemented basic typographical data types (box, glue, penalty) and typesetting algorithm. Other TeX modules (TeX::DVI, TeX::Hyphen, and Font::TFM) were also used.

Description

Module BGP implements basic algorithms for dealing with TeX-like box-glue-penalty model of typesetting.

The main parent class is BGP (stands for box-glue-penalty). It provides generic methods that other classes may inherit if they do not want to specify their own.

Next methods are HBox and VBox that allow horizontal and vertical stacking of other objects and form objects of them. HGlue and VGlue implement glues -- stretchable and shrinkable spaces. Class Space is a shortname for a space in given font.

Penalty is the value to be addes to the badness function in case breakpoint at the penalty is chosen.

Class Word packs letters of given font. It also uses information about kerning pairs and ligatures.

List is a generic class for making a list (array) of objects.

Breakpoint, Breaking and Paragraph build open interface to typesetting algorithms, namely optimum fit line breaking.

Download

The module consists of single BGP.pm file.