lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheme version of ly:ledger-line-spanner::print


From: Paul Morris
Subject: Scheme version of ly:ledger-line-spanner::print
Date: Tue, 18 Aug 2015 23:22:50 -0400

Recently I looked into trying to rewrite ly:ledger-line-spanner::print in 
Scheme, in order to do some customization of ledger lines.  I didn’t get very 
far...  I then tried to wrap it in my own function in order to post-process the 
stencil it produced.  But I found it produces one stencil per musical system. 
(!)  So it seems a Scheme rewrite might be needed after all.

I realize this is no small task (the function is over 150 lines of code), but I 
thought I’d post about it just in case anyone else has the time and inclination 
to have a go at it.  Currently it’s a bit beyond my skill set.

Cheers,
-Paul


\version "2.19.22"

\layout {
  ragged-right = ##t
}

% there is ony one ledger line spanner/grob/stencil 
% produced for each musical system on the page (!)
% see: ledger-line-spanner.cc for c++ code for ly:ledger-line-spanner::print

#(define (MyLedgerLineSpannerPrint grob)
   (let*
    ((stil (ly:ledger-line-spanner::print grob))
      ;; (ifaces (ly:grob-interfaces grob))

      (noteheads (ly:grob-object grob 'note-heads))
      (new-stil (box-stencil (stencil-with-color stil blue) 0.1 1))
      )

    (display "noteheads: ")(display noteheads)(newline)(newline)
    ;; (display (ly:grob-properties grob))(newline)(newline)
    ;; (display ifaces)(newline)(newline)

     new-stil))


\new Staff \with {
  \override LedgerLineSpanner.stencil = #MyLedgerLineSpannerPrint
  \override LedgerLineSpanner.after-line-breaking = #grob::display-objects
} {
  c <d e> f''' g'''
  \break
  c2 e
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]