lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for issue #1116 (one stencil in fill-line) (issue1689041)


From: perpeduumimmobile
Subject: Re: Patch for issue #1116 (one stencil in fill-line) (issue1689041)
Date: Mon, 12 Jul 2010 16:18:35 +0000

On 2010/07/01 22:27:42, Neil Puttock wrote:
Hi Alexander,

LGTM.
Thanks.

It just needs some regression tests; the examples from #1116 and #382
should
suffice.

I did not write those - I'm not yet perfectly convinced that the
handling of word-space is the right thing to do (see below).

http://codereview.appspot.com/1689041/diff/2001/3001#newcode845
scm/define-markup-commands.scm:845: (set! line-stencils empty-stencil)
Hmm, line-stencils isn't appropriate from this point, since it's no
longer a
list of stencils; perhaps it would be clearer to bind to another
variable?

Not sure how to name it, then. I used the large if clause, but I'm not
sure if this is good coding style in scheme? Looks more like an early
return from imperative languages...

http://codereview.appspot.com/1689041/diff/2001/3001#newcode847
scm/define-markup-commands.scm:847: (stack-stencils-padding-list
indent
Done.


Regarding word-space:

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.

http://codereview.appspot.com/1689041/show



reply via email to

[Prev in Thread] Current Thread [Next in Thread]