The text system currently supports only horizontal text layout. The NSLayoutManager proposes a rectangle for a given line, and then asks the NSTextContainer to adjust the rectangle to fit. The proposed rectangle usually spans the NSTextContainer's bounding rectangle, but it can be narrower or wider, and it can also lie partially or completely outside the bounding rectangle. The message that an NSLayoutManager sends the container to adjust the proposed rectangle is lineFragmentRectForProposedRect , which returns the largest rectangle available for the proposed rectangle, based on the direction text is laid out. It also returns a rectangle containing any remaining space, such as that left on the other side of a hole or gap in the NSTextContainer.
Text is laid out along lines that run either horizontally or vertically, and in either direction.
This type of movement is called the sweep direction and is expressed by the sweep direction constants. The direction in which the lines progress is then called the line movement direction and is expressed by the line movement constants. LineDoesntMove For the three examples above, the sweep direction is LineSweepRight and the line movement direction is LineMovesDown . In the first example, the proposed rectangle spans the region's bounding rectangle and is shortened by the text container to fit inside the hourglass shape with no remainder. The next rectangle proposed by the NSLayoutManager will then be this remainder rectangle, and will be returned unchanged by the text container.