bug-lilypond
[Top][All Lists]
Advanced

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

Re: Noteheads slightly too large


From: Pierre Perol-Schneider
Subject: Re: Noteheads slightly too large
Date: Tue, 9 Feb 2016 22:30:55 +0100

Hi Paul,


2016-02-09 16:48 GMT+01:00 Paul Morris <address@hidden>:


> \version "2.19.36"
>
> example = \relative {
>   c' d e f g a b c
> }
>
> {
>   \example
> }
>
> {
>   \override NoteHead.stencil =
>   #(lambda (grob)
>      (ly:stencil-scale
>       (ly:note-head::print grob)
>       250/276  250/276))
>
>   \example
> }
>

Some thoughts regarding the use of ly:stencil-scale:
1. the command seems to have a side effect on the stem attachment (or
probably no effect on the note head extents - tested on a W8 OS)
2. applying it on all note heads suppose that all glyphs have the same
scale defects (which is not the case, see my example with the harmonic
style).

So here's my attempt to get something liable to all note head styles.
Unfortunately I did note find any direct procedure to get the 'default
style ( '() do not work):

\version "2.19.36"
#(set-global-staff-size 180)
#(set-default-paper-size "a4" 'landscape)

#(define (my-note-heads grob)
   (let* ((style (ly:grob-property grob 'style))
          (duration (ly:grob-property grob 'duration-log)))
            (case duration
               ((-1)
                (lambda (grob)
                        (ly:stencil-scale
                          (ly:note-head::print grob)
                          268/276  261/276)))
               ((0)
                (lambda (grob)
                        (ly:stencil-scale
                          (ly:note-head::print grob)
                          268/276  262/276)))
               ((1)
                (lambda (grob)
                        (ly:stencil-scale
                          (ly:note-head::print grob)
                          268/276  263/276)))
               ((2)
                (lambda (grob)
                        (ly:stencil-scale
                          (ly:note-head::print grob)
                          268/276  264/276)))
               (else (ly:note-head::print grob)))))

#(define (my-note-heads-new grob)
   (let* ((style (ly:grob-property grob 'style))
          (duration (ly:grob-property grob 'duration-log)))
;; "TODO: this means that 'my-note-heads-new
;; should apply only for the 'default style
;; does not work here though!
     ;(case style
       ;(('())
            (case duration
               ((-1)
                (grob-interpret-markup grob
                  #{
                    \markup {
                      \scale #'(0.98 . 0.96)
                      \musicglyph #"noteheads.sM1"
                    }
                  #}))
               ((0)
                (grob-interpret-markup grob
                  #{
                    \markup {
                      \scale #'(0.98 . 0.95)
                      \musicglyph #"noteheads.s0"
                    }
                  #}))
               ((1)
                (grob-interpret-markup grob
                  #{
                    \markup {
                      \scale #'(0.98 . 0.95)
                      \musicglyph #"noteheads.s1"
                    }
                  #}))
               ((2)
                (grob-interpret-markup grob
                  #{
                    \markup {
                      \scale #'(0.98 . 0.95)
                      \musicglyph #"noteheads.s2"
                    }
                  #}))
          ;((harmonic)
               ;   (grob-interpret-markup grob
               ;     #{
               ;      \markup {
               ;         \scale #'(0.98 . 0.94)
                ;        \musicglyph #"noteheads.s0harmonic"
               ;       }
                ;    #}))
               (else (ly:note-head::print grob)))))

%% Test 1:
\relative {
  \override Staff.NoteHead.stencil = #my-note-heads
  %\override Staff.NoteHead.stencil = #my-note-heads-new
  d'4 f2*1/2 a1*1/4 c\breve*1/8
%% Test 2:
  %d'4 f2*1/2\harmonic a1*1/4 c\breve*1/8
}

Cheers,
Pierre


reply via email to

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