[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue 1234 in lilypond: Fill-line should not use word space, but sho
From: |
lilypond |
Subject: |
Re: Issue 1234 in lilypond: Fill-line should not use word space, but should use springs-and-rods |
Date: |
Tue, 24 Aug 2010 07:12:53 +0000 |
Updates:
Labels: Type-Enhancement Priority-Low
Comment #1 on issue 1234 by Carl.D.Sorensen: Fill-line should not use word
space, but should use springs-and-rods
http://code.google.com/p/lilypond/issues/detail?id=1234
From Alexander's comments on Rietveld issue 1689041:
http://codereview.appspot.com/1689041
I reintroduced word-space property to ensure that texts don't collide. This
seems not the best way, though. Consider
\markup \column {
\fill-line { "|" "|" "|" "|" }
\fill-line { "|" "veeeeeeeeeeeeeeeeeeeeeeeeeeery long text"
"veeeeeeeeeeeeeeeeeeeery long text" "|" }
}
(Without word-space in the last version of my patch, this let's the texts
collide.)
Expected output should be this text fitted into one line, not exceeding the
linewidth unless absolutely necessary (i.e., text-width + (n-1)*word-space >
linewidth).
I think the best way would be to solve some minimization problem in the
springs-and-rods style:
- fix the leftmost and rightmost markup to hit the boundaries of the line
- minimize sum over all squared distances of center of texts and optimal
center points, which are at (2*i / (2*n+1) * line-width) for n stencils,
subject to non-overlapping texts.
Perhaps, a weight should be added depending on the lengths of the texts:
The narrower the text, the more visible is the deviation from the optimal
position, IMHO.
IIUC, the necessary code for the optimization is already there, but I don't
know where to look. I certainly could reinvent the wheel and implement the
Simplex algorithm in Scheme, but I'm sure someone already did better.
Reply