optimize link area in toc

This commit is contained in:
Christoph Wagner 2025-01-28 00:26:18 +01:00
parent e4b65aafcb
commit 7b97e04fab

View File

@ -161,16 +161,13 @@
(markup #:override (cons 'baseline-skip 3.5) (if catname (make-left-column-markup (string-split (cadr catname) #\newline)) category))))) (markup #:override (cons 'baseline-skip 3.5) (if catname (make-left-column-markup (string-split (cadr catname) #\newline)) category)))))
#(define-markup-command (index-item-with-pattern layout props)() #(define-markup-command (index-item-with-pattern layout props)()
(let ( (let* (
(text (chain-assoc-get 'index:text props)) (text (chain-assoc-get 'index:text props))
(page (chain-assoc-get 'index:page props)) (page (chain-assoc-get 'index:page props))
(width (- (width (-
(chain-assoc-get 'line-width props) (chain-assoc-get 'line-width props)
(interval-length (ly:stencil-extent (interpret-markup layout props "XXXX") X)))) (interval-length (ly:stencil-extent (interpret-markup layout props "XXXX") X))))
) (lines-reversed
(interpret-markup layout props
(make-column-markup
(let ((revlist
(if (markup? text) (if (markup? text)
(list text) (list text)
(reverse (map (lambda (stil) (markup #:stencil stil)) (reverse (map (lambda (stil) (markup #:stencil stil))
@ -179,17 +176,25 @@
(list (cons 'line-width width) (cons 'font-shape 'italic)) (list (cons 'line-width width) (cons 'font-shape 'italic))
(list (cons 'line-width width))) props) #f (list (cons 'line-width width))) props) #f
(chain-assoc-get 'rawtext text)))))) (chain-assoc-get 'rawtext text))))))
(target-size-markup (last-line-with-dots (make-fill-with-pattern-markup 1 RIGHT "." (car lines-reversed) page))
(lines-without-dots (cdr lines-reversed))
(target-line-size-markup
(make-column-markup (make-column-markup
(list (list
(make-simple-markup "Agj") (make-simple-markup "Agj")
(make-vspace-markup 0.2)))) (make-vspace-markup 0.2))))
) )
(reverse (map (lambda (m) (interpret-markup layout props
(make-size-box-to-box-markup #f #t m target-size-markup)) (make-size-box-to-box-markup #f #t
(cons (make-with-link-symbol-ref-markup 'index:label
(make-with-link-symbol-ref-markup 'index:label (make-fill-with-pattern-markup 1 RIGHT "." (car revlist) page)) (make-column-markup
(cdr revlist))))))))) (reverse (cons
last-line-with-dots
(map (lambda (m) (make-size-box-to-box-markup #f #t m target-line-size-markup)) lines-without-dots)))))
; this column is just to have a reference height for resizing
(make-column-markup
(reverse (map (lambda (m) (make-size-box-to-box-markup #f #t m target-line-size-markup)) (cons last-line-with-dots lines-without-dots))))
))))
\paper { \paper {
indexItemMarkup = \markup { indexItemMarkup = \markup {