Hi, Thomas:
On Sunday, April 20, 2014 8:36:04 AM, Thomas Morley <[email protected]> 
wrote:
 
2014-04-20 14:30 GMT+02:00 Thomas Morley <[email protected]>:
> 2014-04-20 3:23 GMT+02:00 Thomas Morley <[email protected]>:
>> 2014-04-19 23:25 GMT+02:00 MING TSANG <[email protected]>:
>>> The color solfege will be showing on the lower
>>> stack in both case.
>
>> I found no convincing method to set the color for the TextScript, though.
>> I used a workaround, hoping someone else comes up with a better solution.
>
> Hi again,
>
> I found a way to clear the 'tweaks for newgrob:
>
> #(define (solfege-engraver lst dir)
>    (make-engraver
>      (acknowledgers
>       ((note-head-interface engraver grob source)
>        (let* (
>               (context (ly:translator-context engraver))
>               (tonic-pitch (ly:context-property context 'tonic))
>               (tonic-index (ly:pitch-notename tonic-pitch))
>               (event (ly:grob-property grob 'cause))
>               (event-copy (ly:event-deep-copy event))
>               (grob-pitch (ly:event-property event 'pitch))
>               (grob-index (ly:pitch-notename grob-pitch))
>               (delta (modulo (- grob-index tonic-index) 7))
>               (name (list-ref lst delta))
>               (newgrob (ly:engraver-make-grob engraver 'TextScript 
>event-copy))

Please delete the following two lines:


>               (newgrob-cause (ly:grob-property newgrob 'cause))
>               (newgrob-tweaks (ly:event-property newgrob-cause 'tweaks))

)
>
>          ;; clear 'tweaks for newgrob
>          (ly:event-set-property! event-copy 'tweaks '())
>          (if (string= name "Hb")  (set! name "B"))
>          ;; Give newgrob 'outside-staff-priority depending on
>          ;; grob 'staff-position
>          (set! (ly:grob-property newgrob 'outside-staff-priority)
>                (+ (ly:grob-property newgrob 'outside-staff-priority)
>                   (* dir (ly:grob-property grob 'staff-position))))
>          (set! (ly:grob-property newgrob 'text) name)
>          (set! (ly:grob-property newgrob 'direction) dir) )))))
>
> HTH,
>   Harm


Thank you for modify the solfege-engraver.  
I copy and paste into the .ly file and ran.  Result: The below staff seems 
working, but "\xup" suppose to put the solfege above staff and now it is put 
below the staff instead - and the stacking is not right.  Any idea?

Emmanuel,
Ming.
\version "2.19.4"
\language "english"

%%%%%%%%%%%%%%%\include "include_solfege-engraver.ly"
#(define syllables '("do" "re" "mi" "fa" "so" "la" "ti"))
#(define syls '("d" "r" "m" "f" "s" "l" "t"))
#(define numR➀ '("➀" "➁" "➂" "➃" "➄" "➅" "➆"))
#(define number '("1" "2" "3" "4" "5" "6" "7"))
#(define numR➑ '("➊" "➋" "➌" "➍" "➎" "➏" "➐"))

#(define (solfege-engraver lst dir)
   (make-engraver 
     (acknowledgers
      ((note-head-interface engraver grob source)
       (let* (
              (context (ly:translator-context engraver))
              (tonic-pitch (ly:context-property context 'tonic))
              (tonic-index (ly:pitch-notename tonic-pitch))
              (event (ly:grob-property grob 'cause))
              (grob-pitch (ly:event-property event 'pitch))
              (grob-index (ly:pitch-notename grob-pitch))
              (delta (modulo (- grob-index tonic-index) 7))
              (name (list-ref lst delta))
              (newgrob (ly:engraver-make-grob engraver 'TextScript event)))
         (if (string= name "Hb")  (set! name "B"))
         (set! (ly:grob-property newgrob 'text) name)
         (set! (ly:grob-property newgrob 'direction) dir) )))))


xup = \with { \consists #(solfege-engraver syllables UP) }
xdown = \with { \consists #(solfege-engraver syllables DOWN) }
zup= \with { \consists #(solfege-engraver syls UP) }
zdown= \with { \consists #(solfege-engraver syls DOWN) }
nup= \with { \consists #(solfege-engraver number  UP) }
ndown= \with { \consists #(solfege-engraver number  DOWN) }
rup= \with { \consists #(solfege-engraver numR➀ UP) }
rdown= \with { \consists #(solfege-engraver numR➀ DOWN) }
sup= \with { \consists #(solfege-engraver numR➑ UP) }
sdown= \with { \consists #(solfege-engraver numR➑ DOWN) }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end
clors =
#(define-music-function (parser location which color music)
    ((procedure? car) color? ly:music?)
  (music-map
    (lambda (mus)
      (if (music-is-of-type? mus 'event-chord)
          (let* ((evt-chrd-nts (event-chord-notes mus)))
           (if (> (length evt-chrd-nts) 1)
               (let ((first-nh (which evt-chrd-nts)))
                 #{ \tweak #'color #color #first-nh #})
               mus)
            mus)
          mus))
    music))             % default #first     #last is the top notehead 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 boo =
#(define-music-function
      (parser location color the-music)
      (color? ly:music?)
    #{
      \temporary \override NoteHead.color = #color
     
      #the-music
      \revert NoteHead.color
  
    #})                %\boo#blue {..}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SA = {d''4. d''8 d''8  <c''e''>8 <b'd''>8 f'8 |%m73
  <<{\voiceOne a'2 a'4 f'8 e'8}\new Voice{\voiceTwo \boo#red {c'4 d'4 f'4 f'4} }>> \oneVoice |%m74
  d'4. <g'b'>8 <f'b'>8 <g'b'>8 q4 |%m75
}

verseA = \lyricmode {
  re re re mi re fa la la fa mi re so so so re  
}


<<
\new Staff \with { \xup
    
  } <<
    \new Voice = "soprano"  { \voiceOne \clors #first #red \SA }
  >>
  \new Lyrics 
    \lyricsto "soprano" \verseA
>>

<<
\new Staff \with { \xdown
    
  } <<
    \new Voice = "soprano"  { \voiceOne \clors #first #blue \SA }
  >>
  \new Lyrics 
    \lyricsto "soprano" \verseA
>>

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

Reply via email to