Name

packer->fill_text -- fill provided text into remaining free space

Synopsis

mixed packer->fill_text ( string text[, float padding[, float minwidth]] )

Description

This function takes the text provided in text and places it on the page, using whatever free space remains in the free space map, using the current default text settings.

padding specifies an amount away from the edge of each field to hold the text. This prevents the text from running together when fields have edges that touch. The value is in em (the width of the letter "M" in the current font) and defaults to 1.

minwidth is the minimum width fragment that should be used. Fragments narrower than minwidth are not used to place text. The calculation takes padding in to account, so the actual width of the fragment must equal or exceed 2 * padding + minwidth. The value is in em.

The function returns true if all text was placed. If the text could not be fit in the available free space, the text that was not placed is returned.

Examples

See example-packer.php in the examples directory.

See Also

History

Added with the packer in 2.6

Bugs

This should create new pages as needed, but the logic to do so without "shooting the programmer in the foot" has not occured to me yet.

The layout policy is "closest fragment to upper-left corner". Aside from being non-i18n, this policy probably won't always flow text in the way the user would like.