From ed72ba9abbed89d0e6209ea48ba0fd05ac00912f Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Mon, 14 Feb 2011 12:21:01 +0100 Subject: [PATCH] Add dots to tocItemMarkup * New markup command fill-with-dots * Add it to tocItemMarkup --- ly/toc-init.ly | 4 +--- scm/define-markup-commands.scm | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ly/toc-init.ly b/ly/toc-init.ly index dda4f31..1f07fb6 100644 --- a/ly/toc-init.ly +++ b/ly/toc-init.ly @@ -26,9 +26,7 @@ \fill-line { \null "Table of Contents" \null } \hspace #1 } - tocItemMarkup = \markup \fill-line { - \fromproperty #'toc:text \fromproperty #'toc:page - } + tocItemMarkup = \markup \fill-with-dots \fromproperty #'toc:text \fromproperty #'toc:page } #(define-markup-list-command (table-of-contents layout props) () diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 5dbc5d2..8e6514f 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1013,6 +1013,26 @@ determines the space between markups in @var{args}. word-space (remove ly:stencil-empty? stencils)))) +(define-markup-command (fill-with-dots layout props left right) + (markup? markup?) + #:category align + " address@hidden filling line with dots +Fill-line between markups @code{left} and @code{right} with a postscript dotted line address@hidden, quote] +\\markup { + \\fill-with-dots left right +} address@hidden lilypond" + (let* ((left-width (cdr (ly:stencil-extent (interpret-markup layout props left) X))) + (right-width (cdr (ly:stencil-extent (interpret-markup layout props right) X))) + (middle-width (- (ly:output-def-lookup layout 'line-width) (+ left-width right-width))) + (offset (- middle-width (* (truncate (/ middle-width 1.5)) 1.5)))) + (interpret-markup layout props + (markup left + #:with-dimensions (cons 0 middle-width) '(0 . 0) #:postscript (string-append "0.25 setlinewidth 1 setlinecap [0 1.5] 0 setdash " (number->string offset) " 0.12 moveto " (number->string middle-width) " 0 rlineto stroke") + right)))) + (define-markup-command (concat layout props args) (markup-list?) #:category align -- 1.7.1