]> git.donarmstrong.com Git - lilypond.git/commitdiff
tablature enhancement: hammer on/pull off
authorMarc Hohl <marc@hohlart.de>
Tue, 6 Oct 2009 08:01:33 +0000 (10:01 +0200)
committerCarl Sorensen <c_sorensen@byu.edu>
Sat, 10 Oct 2009 03:18:28 +0000 (21:18 -0600)
By modifying the stems accordingly, they do not influence the
calculation of the slur control-points, so we minimize problems
using slurs in tablature.

The routine for minimizing the distance between the slur and the
fret number is still not ideal, but should work in most cases.

ly/engraver-init.ly
ly/property-init.ly
scm/tablature.scm

index 7069652e42ed75da55d5f0c8a23bbb6da067f7c2..6147b7fd8df5f1bb524ebf935698245c5557fc8a 100644 (file)
@@ -714,8 +714,24 @@ context."
 
   %% No accidental in tablature !
   \remove "Accidental_engraver"
-  %% remove stems, beams, dots and rests ...
-  \override Stem #'stencil = ##f
+  %% make the Stems as short as possible to minimize their influence 
+  %% on the slur::calc-control-points routine
+  \override Stem #'length = #0
+  \override Stem #'no-stem-extend = ##t
+  \override Stem #'flag-style = #'no-flag
+  \override Stem #'details = #'((lengths 0 0 0 0 0 0)
+                                (beamed-lengths 0 0 0)
+                                (beamed-minimum-free-lengths 0 0 0)
+                                (beamed-extreme-minimum-free-lengths 0 0)
+                                (stem-shorten 0 0))
+  %% after all, the stubs of thestems may still be visible, so ...
+  \override Stem #'transparent = ##t
+  %% automatic beams should be suppressed for similar reasons ...
+  autoBeaming = ##f
+  %% ... and we ignore collision warnings that may occur due to
+  %% stem overlapping ...
+  \override NoteColumn #'ignore-collision = ##t
+  %% remove beams, dots and rests ...
   \override Beam #'stencil = ##f
   \override Dots #'stencil = ##f
   \override Rest #'stencil = ##f
@@ -724,7 +740,7 @@ context."
   \override Tie  #'stencil = ##f
   \override RepeatTie #'stencil = ##f
   \override LaissezVibrerTie #'stencil = ##f
-  \override Slur #'stencil = ##f
+  \override Slur #'stencil = #slur::draw-tab-slur
   \override PhrasingSlur #'stencil = ##f
   %% 'tied to' fret numbers become invisible or parenthesized, respectively)
   \override Tie #'after-line-breaking = #tie::handle-tab-note-head
index b982843cf9d3ec8f2f145acb2da0a1dbb5503839..b64c8b577d9865d66de61393775bdf4ebbf5bc9b 100644 (file)
@@ -375,7 +375,14 @@ tabFullNotation = {
   % time signature
   \revert TabStaff.TimeSignature #'stencil
   % stems (the half note gets a double stem)
+  \revert Stem #'length
+  \revert Stem #'no-stem-extend
+  \revert Stem #'flag-style
+  \revert Stem #'details
+  \revert Stem #'transparent
   \override TabVoice.Stem #'stencil = #tabvoice::draw-double-stem-for-half-notes
+  autoBeaming = ##t
+  \revert NoteColumn #'ignore-collision
   % beams, dots
   \revert TabVoice.Beam #'stencil
   \revert TabVoice.Dots #'stencil
index 883b09ae1c1a8f19e84286aef09ad942e0327ab1..054f3416d13c0c1da1ab6573f83b9c37461f514b 100644 (file)
                                         (lambda (grob)
                                                 (parenthesize-tab-note-head grob))))
             ;; tab note head is invisible
-            (ly:grob-set-property! tied-tab-note-head 'transparent #t))))
\ No newline at end of file
+            (ly:grob-set-property! tied-tab-note-head 'transparent #t))))
+
+;; the slurs should not be too far apart from the corresponding fret number, so
+;; we move the slur towards the TabNoteHeads:
+#(define-public (slur::draw-tab-slur grob)
+  ;; TODO: use a less "brute-force" method to decrease
+  ;; the distance between the slur ends and the fret numbers
+  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
+         (staff-space (ly:grob-property staff-symbol 'staff-space))
+         (control-points (ly:grob-property grob 'control-points))
+         (new-control-points (map (lambda (p)
+                                          (cons (car p) (- (cdr p)
+                                                        (* staff-space
+                                                           (ly:grob-property grob 'direction)
+                                                           0.35))))
+                                  control-points)))
+        (ly:grob-set-property! grob 'control-points new-control-points)
+        (ly:slur::print grob)))
\ No newline at end of file