lilypond-user
[Top][All Lists]
Advanced

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

Re: how to move TextScript closer to the staff?


From: Eluze
Subject: Re: how to move TextScript closer to the staff?
Date: Sun, 1 Dec 2013 05:11:50 -0800 (PST)

karol wrote
>> what do you mean by that - example?
> 
> Take a lok here:
> http://lilypond.1069038.n5.nabble.com/fingering-overlap-bug-td154572.html
> 
>> maybe you can adapt http://lsr.dsi.unimi.it/LSR/Item?id=637 to your needs
>> (see the file below)
> 
> The numerals are not centered, but that's not a big problem for me. What I
> want is to have them closer to staff in situations like:
> 
> { <fis' b' d'>4 ^\markup \fingerMod { 1 3 5 } c'2. }

here is the code for what I thought once was in this snippet:

textScriptCenterOnNote = \override TextScript #'X-offset = #(lambda (grob)
   (let* ((paper-col (ly:grob-parent grob X))
          (elts (ly:grob-object paper-col 'elements))
          (rhythmic-head
           (if (ly:grob-array? elts)
               (let loop ((array-idx 0))
                 (call/cc
                  (lambda (return)
                    (let ((array-len (ly:grob-array-length elts)))
                      (if (< array-idx (1- array-len))
                          (let ((elt (ly:grob-array-ref elts array-idx)))
                            (if (grob::has-interface elt
                                                    
'rhythmic-head-interface)
                                (return elt)
                                (loop (1+ array-idx)))))
                      grob))))
               grob)))

     (+
      (ly:self-alignment-interface::x-aligned-on-self grob)
      (interval-center
       (ly:grob-robust-relative-extent rhythmic-head rhythmic-head X)))))


for the most common cases this should work:

{ 
 \textScriptCenterOnNote
  \override TextScript.self-alignment-X=#1
  <fis' b' d'>4 ^\markup
  \fingerMod { 1 3 5 } c'2. 
}  

if there are shifted notes and accidentals, you can augment the X-offset for
Fingering or TextScript:

{
  \textScriptCenterOnNote
  \once \override TextScript.self-alignment-X=#1
  \stemUp <fis' b' d'>4 ^\markup {
    \override #'(baseline-skip . 1.5) \bold \finger \center-column { 5 3 1 }
  }
  r2.
  \once {
    \override Fingering.self-alignment-X=#9.8
    \override Fingering.color=#cyan
  }
  <e'' f'' cis'''>1 ^1^2^5 
  \once \override TextScript.self-alignment-X=#8
  <dis'' a'' b''>1 ^\markup {
    \override #'(baseline-skip . 1.5) \bold \finger \center-column { 5 4 1 }
  }
}

- or wait till the issue(s) is fixed

hth
Eluze



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/how-to-move-TextScript-closer-to-the-staff-tp154741p154783.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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