[Suggestion] Justification
Klebestreifen opened this issue ยท 2 comments
Justify alignments look very neat. Therefore, I would like to have such a feature.
Let
W be the list of words for a line
l(x) be the length in pixels of a word or list of words x
c(x) the number of elements in the list x
L be the length of the line
X be the draw position, starting at 0
- Draw W0 at X
- Increment X by l(W0)
- Remove W0 from W
- Calculate S as round((L - X - l(W)) / C(W))
- Increment X by S
- Draw W0 X
- Increment X by l(W0)
- Remove W0 from W
- repeat from 4 unless W is empty
Yes, this has a certain bias to one side depending on the rounding function used, the alternative is to calculate the word distance once and then keep a record of the rounding error.