In printed scores, there are typically a few pages of introduction and then on 
the first real score page, the footer displays the copyright notice.

I'm trying to implement this in lilypond, too, using the \on-the-fly approach, 
together with the concepts taken from Nicolas' fancy-headers.ily package. 
Now, this appears to work quite well: For each page, where the copyright 
notice should be shown in the footer, I add a page-marker and then compare 
its page number with the current page number in the procedure passed to 
on-the-fly. However, there is one problem left:
Even if there is no markup generated by the on-the-fly procedure (because the 
current page does not have the page-mark set), vertical space is reserved for 
the \on-the-fly markup.

Attached are my current tests, where you can see on the second page that there 
is always space reserved for the copyright notice, even if it's not printed.

Is this because the on-the-fly procedure returns a stencil containing 
`(delay-stencil-evaluation ,(delay (ly:stencil-expr....))), which is of 
course not equal to an empty stencil (or at least, it cannot be decided until 
the labels and then the stencil is evaluated)? In this case, is there any 
workaround?
Or am I doing something else wrong?

Cheers,
Reinhold

PS: I'll be doing the same also for the score number, printed in the footer, 
except on pages with a given mark, so I don't want one function to generate 
all of the footer, but only some parts of the footer to make it more modular 
for my orchestrallily package.

PS2: In case you are interested what all my questions are about lately and 
what I really did with all the great answers and your help, I put the first 
seven pages of my latest edition on our web server:
http://www.fam.tuwien.ac.at/~reinhold/temp/Pembaur_VierteLateinischeMesse_LongScore_Pages1-7.pdf

As you can see, the score is really approaching print quality - at least the 
introductions (modulo some spacing, because I changed the staff-size). The 
score itself still needs some layouting tweaks to make it look professional.
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
\version "2.11.46"
#(set-default-paper-size "a7" 'landscape)
#(set-global-staff-size 13)


\header {
  title="Title of the score"
  composer="The composer"
  copyright="Copyright footer"
  scorenumber="Number of the score"
  publisher = "The publisher"
}

#(define (page-number-for-label layout label)
  (let* ((table (ly:output-def-lookup layout 'label-page-table))
         (label-page (and (list? table) (assoc label table)))
         (page-number (and label-page (cdr label-page)))
        )
    page-number
  )
)
  

#(define copyright-footer-table '())

#(define thisPageCopyrightFooter-music #f)
#(define is-copyright-page #f)
#(let ((copyright-table (list)))
  (set! is-copyright-page
    (lambda (layout props arg)
      (ly:make-stencil `(delay-stencil-evaluation ,(delay (ly:stencil-expr
          (begin
            (if (and (null? copyright-table) 
                     (not (null? copyright-footer-table)))
              (for-each (lambda (label)
                (let* ((page-number (page-number-for-label layout label)))
                  (if page-number 
                    (set! copyright-table (cons page-number copyright-table))
                  )
                )
              )
              copyright-footer-table)
            )
            (let* ((page-number (chain-assoc-get 'page:page-number props -1)))
              (if (memq page-number copyright-table)
                ; This is a copyright page!
                (interpret-markup layout props arg)
                empty-stencil
              )
            )
          )
        )))
        (cons 0 0)
        (cons 0 0)
        ;(ly:stencil-extent (interpret-markup layout props "XXX") Y)
      )
    )
  )
  (set! thisPageCopyrightFooter-music
    (lambda (parser) 
      (let* ((label (gensym "copyrightfooter")))
        (set! copyright-footer-table (cons label copyright-footer-table))
        (make-music 'Music 'page-marker #t 'page-label label)
      )
    )
  )
)
thisPageCopyrightFooter = #(define-music-function (parser location) ()
  (thisPageCopyrightFooter-music parser)
)



\paper {
  oddFooterMarkup = \markup {
    \column {
      \line {"---------------"}
      %% publisher header field only on title page. This does not add 
      %% space if no markup is shown:
      \on-the-fly #first-page \fill-line {
        \fromproperty #'header:publisher
        \null
      }
      \line {"---------------"}
      %% copyright on pages with markers, reserves space even if no 
      %% copyright is inserted on a page:
      \on-the-fly #is-copyright-page \fill-line {
        \fromproperty #'header:copyright
        \null
      }
      \line {"---------------"}
    }
  }

}



\thisPageCopyrightFooter
\markup "With Copyright footer and publisher"

\pageBreak
\markup "No Copyright footer, no publisher"

\pageBreak
\thisPageCopyrightFooter
\markup "With Copyright footer, no publisher"


Attachment: footer-conditional-on-pagemark.pdf
Description: Adobe PDF document

_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to