]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/tablature.scm
Web: Updated Frescobaldi in introduction.itexi
[lilypond.git] / scm / tablature.scm
index 83ad8bdf31597cb082bc819a3baaaac9ae984e40..2adaaa6ed6cc8c55e5f470e401087ebd8aecaba9 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2009--2010 Marc Hohl <marc@hohlart.de>
+;;;; Copyright (C) 2009--2012 Marc Hohl <marc@hohlart.de>
 ;;;;
 ;;;; LilyPond is free software: you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-;; default tunings for common string instruments
-;; guitar tunings
-(define-public guitar-tuning '(4 -1 -5 -10 -15 -20))
-(define-public guitar-seven-string-tuning '(4 -1 -5 -10 -15 -20 -25))
-(define-public guitar-drop-d-tuning '(4 -1 -5 -10 -15 -22))
-(define-public guitar-open-g-tuning '(2 -1 -5 -10 -17 -22))
-(define-public guitar-open-d-tuning '(2 -3 -6 -10 -15 -22))
-(define-public guitar-dadgad-tuning '(2 -3 -5 -10 -15 -22))
-(define-public guitar-lute-tuning '(4 -1 -6 -10 -15 -20))
-(define-public guitar-asus4-tuning '(4 -3 -8 -10 -15 -20))
-;; bass tunings
-(define-public bass-tuning '(-17 -22 -27 -32))
-(define-public bass-four-string-tuning '(-17 -22 -27 -32))
-(define-public bass-drop-d-tuning '(-17 -22 -27 -34))
-(define-public bass-five-string-tuning '(-17 -22 -27 -32 -37))
-(define-public bass-six-string-tuning '(-12 -17 -22 -27 -32 -37))
-;; mandolin
-(define-public mandolin-tuning '(16 9 2 -5))
-;; tunings for 5-string banjo
-(define-public banjo-open-g-tuning '(2 -1 -5 -10 7))
-(define-public banjo-c-tuning '(2 -1 -5 -12 7))
-(define-public banjo-modal-tuning '(2 0 -5 -10 7))
-(define-public banjo-open-d-tuning '(2 -3 -6 -10 9))
-(define-public banjo-open-dm-tuning '(2 -3 -6 -10 9))
-;; convert 5-string banjo tuning to 4-string by removing the 5th string
-(define-public (four-string-banjo tuning)
-  (reverse (cdr (reverse tuning))))
-;; ukulele tunings
-(define-public ukulele-tuning '(9 4 0 7)) ;ukulele  a' e' c' g'
-(define-public ukulele-d-tuning '(11 6 2 9)) ;ukulele d tuning, b' fis' d' a'
-(define-public ukulele-tenor-tuning '(-5 0 4 9)) ;tenor ukulele, g c' e' a'
-(define-public ukulele-baritone-tuning '(-10 -5 -1 4)) ;baritone ukulele, d g b e'
-
 
 ;; for more control over glyph-name calculations,
 ;; we use a custom callback for tab note heads
 
 ;; if stems are drawn, it is nice to have a double stem for
 ;; (dotted) half notes to distinguish them from quarter notes:
+(define-public (tabvoice::make-double-stem-width-for-half-notes grob)
+  (let ((X-extent (ly:stem::width grob)))
+
+    ;; is the note a (dotted) half note?
+    (if (= 1 (ly:grob-property grob 'duration-log))
+        ;; yes -> return double stem width
+        (cons (car X-extent) (+ 0.5 (* 2 (cdr X-extent))))
+        ;; no -> return simple stem width
+        X-extent)))
+
 (define-public (tabvoice::draw-double-stem-for-half-notes grob)
   (let ((stem (ly:stem::print grob)))
 
 (define-public (tab-note-head::print grob)
   (define (is-harmonic? grob)
     (let ((arts (ly:event-property (event-cause grob) 'articulations)))
-      (not (null? (filter (lambda (a)
-                           (ly:in-event-class? a 'harmonic-event))
-                         arts)))))
+      (or (pair? (filter (lambda (a)
+                          (ly:in-event-class? a 'harmonic-event))
+                         arts))
+         (eq? (ly:grob-property grob 'style) 'harmonic))))
 
   (let* ((cautionary (ly:grob-property grob 'display-cautionary #f))
         (details (ly:grob-property grob 'details '()))
         (cautionary-width (assoc-get 'width cautionary-props 0.25))
          (output-grob (ly:text-interface::print grob))
         (ref-grob (grob-interpret-markup grob "8"))
-        (column-offset (interval-length
-                           (ly:stencil-extent
-                             (grob-interpret-markup grob "8")
-                             X))))
+        (offset-factor (assoc-get 'head-offset details 3/5))
+        (column-offset (* offset-factor
+                          (interval-length
+                            (ly:stencil-extent
+                              (grob-interpret-markup grob "8")
+                              X)))))
 
     (if (is-harmonic? grob)
         (set! output-grob (harmonic-proc output-grob