smarter breaks in toc columns closes #2

This commit is contained in:
tux 2023-08-09 16:39:17 +02:00
parent e2dc938c02
commit fbf273dae9

View File

@ -19,13 +19,21 @@
(map (lambda (foo)
(make-general-align-markup Y UP (make-override-markup '(baseline-skip . 1) (make-column-markup
(let add-to-col ((lines restlines) (height-left height))
(let* ((finished (null? lines))
(linestencil (if (not finished) (interpret-markup layout (cons (list (cons 'line-width line-width) (cons 'baseline-skip 1)) props) (markup #:center-align (car lines)))))
(calc-height (- height-left (if finished 0 (interval-length (ly:stencil-extent linestencil Y))))))
(set! restlines lines)
(if (or (< calc-height 0) (null? lines))
(list)
(cons (markup #:stencil linestencil) (add-to-col (cdr lines) calc-height)))))))))
(if (null? lines)
'()
(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)))
)
(if (or (< calc-height 0) no-space-for-next-line)
'()
(cons (markup #:stencil linestencil) (add-to-col (cdr lines) calc-height))))))))))
(make-list cols))))
(if (null? restlines)
(list)
@ -182,8 +190,8 @@
indexItemMarkup = \markup \with-link-symbol-ref #'index:label {
\index-item-with-pattern
}
indexSectionMarkup = \markup \override #'(baseline-skip . 1.5) \column {
\fill-line { \sans \bold \fontsize #3 \fromproperty #'index:text \null }
indexSectionMarkup = \markup \override #'(baseline-skip . 1.5) \left-column {
\sans \bold \fontsize #3 \fromproperty #'index:text
\null
}
indexCategoryMarkup = \markup \override #'(baseline-skip . 1.5) \column {