X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Ftablature.scm;h=2864c5d4b0b4c07969c8ff18479374a5a207ed88;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=668bf2faa3a1b390bc13f2552859fac18cbf1b9b;hpb=e7aa6c445f463844dbaa52d38ea4aac2882b5601;p=lilypond.git diff --git a/scm/tablature.scm b/scm/tablature.scm index 668bf2faa3..2864c5d4b0 100644 --- a/scm/tablature.scm +++ b/scm/tablature.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2009--2014 Marc Hohl +;;;; Copyright (C) 2009--2015 Marc Hohl ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -81,23 +81,33 @@ ;; (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: @@ -224,9 +234,10 @@ ;; 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)