lilypond-user
[Top][All Lists]
Advanced

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

Re: Directional NoteHead Stencil Support


From: tisimst
Subject: Re: Directional NoteHead Stencil Support
Date: Sat, 21 Mar 2015 14:32:34 -0700 (MST)

You and me both, Pierre. I've tried for hours to find something that works automatically. I've managed to use a single notehead for both up- and down-stem notes, thanks to everyone's help here, but I still have one problem relating to chords. 

If a notehead, in a chord stack, is forced out of the main column (to the right for up-stem chords, to the left for down-stem chords) what property (or relationship between grobs) puts them there? I can't seem to figure it out. 

- Abraham

Sent from my iPhone

On Mar 21, 2015, at 2:59 PM, Schneidy [via Lilypond] <[hidden email]> wrote:

Very instructive discussion.
So I feel sorry to come back to some poor basic questions...
And back again to these new glyphs :

\version "2.19.16"
%#(set-global-staff-size 25)

#(define-markup-command (flip layout props arg) (markup?)
   (interpret-markup layout props
     (markup #:concat (#:null #:scale (cons -1 1) #:line (arg)))))

newStilRightDown = \markup {
  \override #'(filled . #t)
  \path #0.01 #'(
     (moveto    0.00   -0.50)
     (curveto   0.00   -0.10   0.00   0.50  0.60   0.50)
     (curveto   1.56    0.50   1.62  -0.50  1.00  -0.50)
     (curveto   0.56   -0.50   0.58  -0.19  0.70   0.00)
     (curveto   0.78    0.13   0.80   0.45  0.50   0.45)
     (curveto   0.06    0.45   0.08  -0.13  0.08  -0.50)
     (closepath))
}

newStilLeftDown = \markup\flip\concat { \hspace #-.04 \newStilRightDown }
newStilLeftUp = \markup\rotate #180 \newStilRightDown
newStilRightUp =  \markup\flip\concat { \newStilLeftUp \hspace #-.04  }

#(define alt-notehead
   (lambda (grob)
     (let ((stem (ly:grob-object grob 'stem)))
       (if (ly:grob? stem) ;; perhaps unnecessary, but let's be safe
           (if (eq? (ly:grob-property stem 'direction) DOWN)
               (grob-interpret-markup grob newStilRightDown)
               (grob-interpret-markup grob newStilLeftUp))))))

#(define new-alt-notehead
   (lambda (grob)
     (let ((stem (ly:grob-object grob 'stem)))
       (if (ly:grob? stem) ;; perhaps unnecessary, but let's be safe
           (if (eq? (ly:grob-property stem 'direction) DOWN)
               ;;; Nonsense here:
                (let ((note-heads (ly:grob-object grob 'note-heads)))
                 (if (eq? (ly:grob-property note-heads 'X-offset) < 0)
                   (grob-interpret-markup grob newStilLeftDown)
                   (grob-interpret-markup grob newStilRightDown)))
               ;;; Nonsense here:
                 ;(if (< 0 (ly:note-head::stem-x-shift))
                   ;(grob-interpret-markup grob newStilLeftUp)
                   (grob-interpret-markup grob newStilRightUp))))))

{
  \override NoteHead.stem-attachment = #'(1 . 0.95)  
  \override Stem.thickness = #1.0
  \override NoteHead.stencil = #alt-notehead
  %\override NoteHead.stencil = #new-alt-notehead
  <c''
    %% wanted flip:
    \tweak stencil #(lambda (grob) (grob-interpret-markup grob newStilLeftDown))
    d'' 
  e''>
 
  <a'
   %% wanted flip:
   \tweak stencil #(lambda (grob) (grob-interpret-markup grob newStilRightUp))
  g'
  f'>
}


(I've added some tweaks to show a better output.)
Basically, I need four note heads instead of one: the idea of 'new-alt-notehead' is to determine whether its X-offset is negative or positive in order to chose the right noteHead .
After many too many trials I feel a little lost.
Any idea ?

Cheers,
Pierre



2015-03-21 21:14 GMT+01:00 Thomas Morley <[hidden email]>:
2015-03-21 17:24 GMT+01:00 David Nalesnik <[hidden email]>:
>
>
> On Fri, Mar 20, 2015 at 1:52 PM, David Nalesnik <[hidden email]>
> wrote:
>>
>>
>> Probably this file will prove more useful as a hacking tool.  It will show
>> you how the different pointer properties are populated.
>>
>
> This is better written:
>
> --David
>

Hi David,

please consider to add it to our source.
It's a very useful developing/debugging tool!


Thanks again,
  Harm

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


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
~Pierre



If you reply to this email, your message will be added to the discussion below:
http://lilypond.1069038.n5.nabble.com/Directional-NoteHead-Stencil-Support-tp173361p173443.html
To start a new topic under User, email [hidden email]
To unsubscribe from Lilypond, click here.
NAML


View this message in context: Re: Directional NoteHead Stencil Support
Sent from the User mailing list archive at Nabble.com.

reply via email to

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