lilypond-user
[Top][All Lists]
Advanced

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

Re: Directional NoteHead Stencil Support


From: Pierre Perol-Schneider
Subject: Re: Directional NoteHead Stencil Support
Date: Sat, 21 Mar 2015 21:58:58 +0100

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 <address@hidden>:
2015-03-21 17:24 GMT+01:00 David Nalesnik <address@hidden>:
>
>
> On Fri, Mar 20, 2015 at 1:52 PM, David Nalesnik <address@hidden>
> 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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user


reply via email to

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