lilypond-user
[Top][All Lists]
Advanced

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

Re: use guile to set specific extra-offset values if stem direction is u


From: David Nalesnik
Subject: Re: use guile to set specific extra-offset values if stem direction is up or down
Date: Mon, 21 May 2012 12:51:22 -0500

Hi José, 

On Mon, May 21, 2012 at 12:25 PM, padovani <address@hidden> wrote:
Hi again,

so.. as the flags are now separate objects (2.15.38), I'm having problems to move them to the same place that I am moving the stems... if I just reproduce the lambda function I am using with Stems with flags, it does not work...

\once \override Stem #'extra-offset =
       #(lambda (grob)
        (if (eq? (ly:grob-property grob 'direction) UP)

         '(-0.02 . -0.25) '(0.02 . 0.25)))

%this fails
\once \override Flag #'extra-offset =
       #(lambda (grob)
        (if (eq? (ly:grob-property grob 'direction) UP)

         '(-0.02 . -0.25) '(0.02 . 0.25)))

So, is there a way to know the Flag direction? Or maybe a wat to access the Stem's grob from the Flag one (so that I can point the function to the Stem properties?).

It would be possible to offset both of them, but I think you might be better served by approaching the problem from a different angle.  You can control the relative positioning of stem and note head through 'stem-attachment, which is a property of NoteHead.  The flag will move along with the stem.  Also, the stem will end in the same place as an ordinary stem.  Try this (the color override is useful to show the start of the stem):

 \version "2.15.38"

customStemAndFlag =
\once \override NoteHead #'stem-attachment = #(lambda (grob) 
      (if (eq? (ly:grob-property grob 'direction) UP)
          '(-0.5 . -0.5)) '(0.5 . 0.5))

\relative c'' {
  %\override Stem #'color = #red
  \stemUp 
  c8 \noBeam 
  \customStemAndFlag
  c
  \stemDown
  c \noBeam 
  \customStemAndFlag
  c
}

HTH,
David

Thank you again,

José


Em 5/21/12 1:10 PM, David Nalesnik escreveu:
José,

On Mon, May 21, 2012 at 11:02 AM, padovani <address@hidden
<mailto:zepadovani.lists@gmail.com>> wrote:

   Oh, I'm sorry... I was reading everything in a hurry and didn't got
   the second part of your message.


No problem!  I learned something new about ly:stem::calc-direction
because of your email: didn't know that it calculates "ideal" directions.

-David


--
http://zepadovani.info


reply via email to

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