1. A computer-readable medium storing computer-executable instructions for performing the steps of: receiving a first width, a character position, and a vertical position associated with a candidate rectangle; receiving parameters defining a constraint that intersects with the candidate rectangle; fitting a first text string to the candidate rectangle; determining a first height associated with the first text string; conducting a preliminary text assignment to identify an unobstructed span corresponding to the candidate rectangle, the unobstructed span associated with a second height; comparing the second height to the first height; if the second height is equal to the first height, determining whether a second text string fitted to the unobstructed span ends in a delimiter, and if the second text string ends in a delimiter, assigning the second text string to the unobstructed span; if the second height is greater than the first height, declaring the candidate rectangle invalid and advancing the vertical position by a predetermined amount; and if the second height is less than the first height refining the unobstructed span.