There is a possible case that there are more than one appropriate wrap positions on a line and we need to choose between them.
Here 'weight' characteristics comes into play.
The general idea is that it's possible to prefer position with lower offset if it's weight is more than the one from
position with higher offset and distance between them is not too big.
Current algorithm uses the
'weight'
in a following manner:
- Calculate product of line length on first wrap location and its weight;
- Calculate product of line length on second wrap location and its weight;
- Compare those products;
Example
Suppose we have two positions that define lines of length 30 and 10 symbols. Suppose that the weights are
'1'
and
'4'
correspondingly.Position with greater weight is preferred because it's product is higher
(
10 * 4 > 30 * 1
)