[Using git 2007-08-19 f3734e9]

[Han-Wen, I'm resending this with slightly improved code and wording
to the lilypond-devel list since it seems that you don't have enough
time to answer.]

> String numbers usually get put next to (left or right) of notes;
> check out the manual on to how to use them - probably you can get
> away with disguising your as the text of a StringNumber grob. If you
> put the markup vertically (below/above) and move it with
> extra-offset, you will get undesirable extra offsets due to notehead
> and stem size which may not scale in the way you expect them to.

Ok, here's my next try.  Perhaps due to my lack of the deeper
knowledge of lilypond internals, I'm stuck now.

  . What must I do to guarantee that the vertical brackets are always
    positioned left of the accidentals?

  . The vertical positioning of the markup objects in the code below
    is done in a very clumsy way, as can be seen easily, but I wasn't
    able to find out how I can shift `ly:bracket' vertically.  It
    appears as if it is always centered relative to the note head it
    is attached to.

    I would like to do it better; however, it should be done *within*
    my `make-vbracket' function because I plan to improve the logic of
    the vertical positioning (depending on the note's pitches).

My code (ab)uses the `Fingering' interface -- I think that single
vertical brackets should become a new grob: Just think of vertical
brackets *plus* fingerings...


       Werner


======================================================================

#(define-public (make-vbracket grob)
  (let* ((event (event-cause grob))
         (digit (ly:event-property event 'digit))
         (mag (magstep (ly:grob-property grob 'font-size)))
         (m (if (< digit 0)
              (markup #:override (cons 'baseline-skip (* mag 3))
                      #:column (#:null
                                #:stencil (ly:bracket Y (cons 0 (* mag (- 
digit)))
                                                      (* mag 0.2) (* mag 0.4))))
              (markup #:override (cons 'baseline-skip (* mag 1))
                      #:column (#:stencil (ly:bracket Y (cons 0 (* mag digit))
                                                      (* mag 0.2) (* mag 0.4))
                                #:null)))))
     m))

vbracket =
#(define-music-function (parser location interval) (number?)
  "Add a vertical bracket, using the given @var{interval} (which can be
negative)."
  (apply make-music
         (append
          (list
           'FingeringEvent
           'origin location)
          (list 'digit interval))))


{
  \override Fingering #'text = #make-vbracket
  \override Fingering #'padding = #0.2
  \set fingeringOrientations = #'(left)
  <c'-\vbracket #2 es' a'>4
  <c' es'! a'-\vbracket #-3 >4
  <c'-\vbracket #2 es' as'-\vbracket #-3 >4
}

{
  \set fingeringOrientations = #'(left)
  <c'-\vbracket #2 es' a'>4
  <c' es'! a'-\vbracket #-3 >4
  <c'-\vbracket #2 es' as'-\vbracket #-3 >4
}

\paper {
  ragged-right = ##t
}

<<inline: fingering.png>>

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to