]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/tablature.scm
Run grand replace for 2015.
[lilypond.git] / scm / tablature.scm
index 668bf2faa3a1b390bc13f2552859fac18cbf1b9b..2864c5d4b0b4c07969c8ff18479374a5a207ed88 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2009--2014 Marc Hohl <marc@hohlart.de>
+;;;; Copyright (C) 2009--2015 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
 ;; (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)))
+    ;; does the stem exist and is it on a (dotted) half note?
+    (if (and (not (equal? X-extent empty-interval))
+             (= 1 (ly:grob-property grob 'duration-log)))
+
+      ;; yes -> return double stem X-extent
+      (let* ((single-stem-width (- (cdr X-extent) (car X-extent)))
+             (separation (ly:grob-property grob 'double-stem-separation 0.5))
+             (total-width (+ single-stem-width separation))
+             (half-width (/ total-width 2)))
+        (cons (- half-width) half-width))
+      ;; no -> return simple stem X-extent
+      X-extent)))
 
 (define-public (tabvoice::draw-double-stem-for-half-notes grob)
-  (let ((stem (ly:stem::print grob)))
-
-    ;; is the note a (dotted) half note?
-    (if (= 1 (ly:grob-property grob 'duration-log))
-        ;; yes -> draw double stem
-        (ly:stencil-combine-at-edge stem X RIGHT stem 0.5)
-        ;; no -> draw simple stem
-        stem)))
+  (let ((stem-stencil (ly:stem::print grob)))
+    ;; does the stem exist and is it on a (dotted) half note?
+    (if (and (ly:stencil? stem-stencil)
+             (= 1 (ly:grob-property grob 'duration-log)))
+
+      ;; yes -> draw double stem
+      (let* ((separation (ly:grob-property grob 'double-stem-separation 0.5))
+             (half-separation (/ separation 2)))
+        (ly:stencil-add
+          (ly:stencil-translate-axis stem-stencil (- half-separation) X)
+          (ly:stencil-translate-axis stem-stencil half-separation X)))
+      ;; no -> draw simple stem (or none at all)
+      stem-stencil)))
 
 ;; as default, the glissando line between fret numbers goes
 ;; upwards, here we have a function to correct this behavior:
 
 
 ;; a callback for custom fret labels
-(define-public ((tab-note-head::print-custom-fret-label fret) grob)
+(define ((tab-note-head::print-custom-fret-label fret) grob)
   (ly:grob-set-property! grob 'text fret)
   (tab-note-head::print grob))
+(export tab-note-head::print-custom-fret-label)
 
 (define-public (tab-note-head::print grob)
   (define (is-harmonic? grob)