lilypond-user
[Top][All Lists]
Advanced

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

NoteHead X-offset, conflict with ly:grob-relative-coordinate?


From: Paul Morris
Subject: NoteHead X-offset, conflict with ly:grob-relative-coordinate?
Date: Sat, 8 Dec 2012 11:24:49 -0500

Hello everyone,  I'm writing a scheme function to override the usual horizontal 
placement of noteheads relative to the stem (in certain instances).  The only 
thing that is not working is the final step of setting the X-offset property of 
the NoteHead grob.

I tracked down the problem, as shown in the tiny example below.  All the notes 
should be moved to the right-hand side of the stem, but the "rel-coord" 
variable that is set by "ly:grob-relative-coordinate" is preventing it from 
working.  After commenting out that variable it works fine.  This seems very 
odd.  Maybe a bug?  Any ideas on what's going on or how to get this to work?

-Paul


\version "2.16.1"  

CustomNoteHeads =
#(lambda (grob)
  (let* 
    (
      (note-col (ly:grob-parent grob 0))

      ;; This...
      (rel-coord (ly:grob-relative-coordinate grob notecol 0)) 
    )
    
    ;; ...mysteriously prevents this from working.
    (set! (ly:grob-property grob 'X-offset) 1.251178 ) 
  )
)

\score {
  \new Staff
    \with { 
      \override NoteHead #'before-line-breaking = \CustomNoteHeads
    }
    { c' d' e' f' }
  \layout { }
}


PS. Here's what the internals reference says about this function:

  Function: ly:grob-relative-coordinate grob refp axis
  Get the coordinate in axis direction of grob relative to the grob refp.

PPS. I tried it in LilyPond 2.17.8-1 but I got this error: Unbound variable: 
notecol 



reply via email to

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