Am 16.02.2012 22:53, schrieb Thomas Morley:
Hi Marc,

2012/2/14 Marc Hohl<m...@hohlart.de>:
Hi Harm,

Do you want to bundle up your definitions in a patch
so they get included future versions of lilypond?

Thanks for your work on this!

Regards,

Marc
I don't know what I'm expected to do here and currently I've less time
as usual to learn it. (Might be better next month).
I'd be deeply grateful if you could do this.
Ok - I just asked you for a patch because it is your merit that we
now have a better function.

SInce this should be the default, I extended the definitions
of \harmonicByFret and \harmonicByRatio.

Patch is attached, but I have no push privileges.

Thanks for your work!

Regards,

Marc

>From b56abfe0b25fdab0cf47388bbc7abbf9b6b31cc4 Mon Sep 17 00:00:00 2001
From: Marc Hohl <m...@hohlart.de>
Date: Fri, 17 Feb 2012 09:59:58 +0100
Subject: [PATCH] Improving \harmonicBy... functions

Thanks to thomasmorle...@googlemail.com, these functions
work now as expected for guitar music. We have dotted harmonics
and mixed harmonic note heads.
---
 ly/music-functions-init.ly |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 4082ea9..7fe9900 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -374,23 +374,33 @@ in the format of @code{all-grob-descriptions}.")
         descriptions)))
 
 harmonicByFret = #(define-music-function (parser location fret music) (number? 
ly:music?)
-  (_i "Convert @var{music} into harmonics; the resulting notes resemble
+  (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
 harmonics played on a fretted instrument by touching the strings above 
@var{fret}.")
   (let* ((fret (number->string fret))
          (pitch (fret->pitch fret)))
         (make-sequential-music
          (list
           #{
+            \set harmonicDots = ##t
             \override TabNoteHead #'stencil = 
#(tab-note-head::print-custom-fret-label fret)
+            \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container
+                                               ly:grob::stencil-height
+                                                 (lambda (grob start end)
+                                                         
(ly:grob::stencil-height grob)))
+            \override NoteHead #'stencil = #(lambda (grob) 
(ly:grob-set-property! grob 'style 'harmonic-mixed)
+                                                    (ly:note-head::print grob))
           #}
           (make-harmonic
             (calc-harmonic-pitch pitch music))
           #{
+            \unset harmonicDots
             \revert TabNoteHead #'stencil
+            \revert NoteHead #'Y-extent
+            \revert NoteHead #'stencil
           #}))))
 
 harmonicByRatio = #(define-music-function (parser location ratio music) 
(number? ly:music?)
-    (_i "Convert @var{music} into harmonics; the resulting notes resemble
+    (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
 harmonics played on a fretted instrument by touching the strings above the 
point
 given through @var{ratio}.")
   (let ((pitch (ratio->pitch ratio))
@@ -398,12 +408,22 @@ given through @var{ratio}.")
        (make-sequential-music
         (list
          #{
+           \set harmonicDots = ##t
            \override TabNoteHead #'stencil = 
#(tab-note-head::print-custom-fret-label fret)
+           \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container
+                                              ly:grob::stencil-height
+                                                (lambda (grob start end)
+                                                        
(ly:grob::stencil-height grob)))
+           \override NoteHead #'stencil = #(lambda (grob) 
(ly:grob-set-property! grob 'style 'harmonic-mixed)
+                                                   (ly:note-head::print grob))
          #}
          (make-harmonic
            (calc-harmonic-pitch pitch music))
          #{
+            \unset harmonicDots
             \revert TabNoteHead #'stencil
+            \revert NoteHead #'Y-extent
+            \revert NoteHead #'stencil
          #}))))
 
 instrumentSwitch =
-- 
1.7.4.1

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to