verbesserte Spaltenumbruchmethode #2

This commit is contained in:
Christoph Wagner 2023-08-10 10:14:01 +02:00
parent 973d72301c
commit 5c6fde06cc

View File

@ -25,15 +25,14 @@
(let* ((line-to-stencil (lambda (line) (interpret-markup layout (cons (list (cons 'line-width line-width) (cons 'baseline-skip 1)) props) (markup line))))
(stencil-height (lambda (stencil) (interval-length (ly:stencil-extent stencil Y))))
(linestencil (line-to-stencil (car lines)))
(calc-height (- height-left (stencil-height linestencil)))
(calc-width (interval-length (ly:stencil-extent linestencil X)))
(is-less-than-half-line-width (< calc-width (/ line-width 2.0)))
(next-line-height (if (null? (cdr lines)) 0 (stencil-height (line-to-stencil (cadr lines)))))
(no-space-for-next-line (and is-less-than-half-line-width (< (- calc-height next-line-height) 0)))
(current-line-height (stencil-height linestencil))
(new-height-left (- height-left current-line-height))
(next-line-height (if (null? (cdr lines)) current-line-height (stencil-height (line-to-stencil (cadr lines)))))
(no-space-for-next-line (and (< next-line-height current-line-height) (< new-height-left next-line-height)))
)
(if (or (< calc-height 0) no-space-for-next-line)
(if (or (< new-height-left 0) no-space-for-next-line)
'()
(cons (markup #:stencil linestencil) (add-to-col (cdr lines) calc-height))))))))))
(cons (markup #:stencil linestencil) (add-to-col (cdr lines) new-height-left))))))))))
(make-list cols))))
(if (null? restlines)
(list)