lilypond-user
[Top][All Lists]
Advanced

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

EasyHeadsOn


From: pabuhr
Subject: EasyHeadsOn
Date: Tue, 25 Sep 2012 20:52:17 -0700

I want large note names with EasyHeadsOn for teaching.

I did the following hacks:

1. commented out the explicit setting of "NoteHead #'font-size" in EasyHeadsOn
   so I could increase the font size.

2. changed the constant dividend in Brew-ez-stencil:

         (radius (/ (+ staff-space line-thickness) 1.5))

   to make the circle larger.

However, I have to constantly play with the dividend as I change staff-spacing.

What I really want to do but don't know how, is to write something like:

         (radius is 1/2 the height of character "G" in the font for NoteHead)

Or something equivalent.

Personally, I think EasyHeadsOn should work this way and not be keyed to the
staff-spacing.

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

EasyHeadsOn = {
        \override NoteHead #'stencil = #note-head::Brew-ez-stencil
%       \override NoteHead #'font-size = #-8
        \override NoteHead #'font-size = #-1
        \override NoteHead #'font-family = #'sans
        \override NoteHead #'font-series = #'bold
}

#(define-public (note-head::Brew-ez-stencil grob)
  (let* ((log (ly:grob-property grob 'duration-log))
         (pitch (ly:event-property (event-cause grob) 'pitch))
         (pitch-index (ly:pitch-notename pitch))
         (note-names (ly:grob-property grob 'note-names))
         (pitch-string (if (and (vector? note-names)
                                (> (vector-length note-names) pitch-index))
                           (vector-ref note-names pitch-index)
                           (string
                            (integer->char
                             (+ (modulo (+ pitch-index 2) 7)
                                (char->integer #\A))))))
         (staff-space (ly:staff-symbol-staff-space grob))
         (line-thickness (ly:staff-symbol-line-thickness grob))
         (stem (ly:grob-object grob 'stem))
         (stem-thickness (* (if (ly:grob? stem)
                                (ly:grob-property stem 'thickness)
                                1.3)
                            line-thickness))
         (radius (/ (+ staff-space line-thickness) 1.5))
         (letter (markup #:center-align #:vcenter pitch-string))
         (filled-circle (markup #:draw-circle radius 0 #t)))

    (ly:stencil-translate-axis
     (grob-interpret-markup
      grob
      (if (>= log 2)
          (make-combine-markup
           filled-circle
           (make-with-color-markup white letter))
          (make-combine-markup
           (make-combine-markup
            filled-circle
            (make-with-color-markup white (make-draw-circle-markup
                                           (- radius stem-thickness) 0 #t)))
           letter)))
     radius X)))



reply via email to

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