[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make tablature half-note stem-spacing adjustable. (issue 110960043 b
From: |
markpolesky |
Subject: |
Re: Make tablature half-note stem-spacing adjustable. (issue 110960043 by address@hidden) |
Date: |
Wed, 09 Jul 2014 07:13:04 +0000 |
Reviewers: dak,
Message:
On 2014/07/09 07:02:48, dak wrote:
https://codereview.appspot.com/110960043/diff/1/scm/define-grob-properties.scm
File scm/define-grob-properties.scm (right):
https://codereview.appspot.com/110960043/diff/1/scm/define-grob-properties.scm#newcode243
scm/define-grob-properties.scm:243: stems of a half note in tablature
when using
@code{\tabFullNotation},
@code{\\tabFullNotation}
I always get confused with that. Are there some places where
@code{\foo} is allowed and other places where it is not?
https://codereview.appspot.com/110960043/diff/1/scm/define-grob-properties.scm#newcode245
scm/define-grob-properties.scm:245: of the default @code{Staff}
staff-space
height.")
Why @code{Staff} here? Is this specific to Staff contexts only? That
would mean
that this is not in @code{TabStaff} ?
Hm. How to word this? If 'double-stem-separation were set to 1, the
horizontal distance between the stems would be the same as the vertical
distance between two staff-lines in a *regular* staff (i.e. the default
Staff.StaffSymbol.staff-space = 1). But TabStaff is not a regular
staff, since its staff-lines are further apart (i.e. the default
TabStaff.Symbol.staff-space = 1.5). If you have a better way to convey
this, let me know.
Mark
Description:
This adds a new property to the Stem grob called 'double-stem-separation
(default=0.5), that allows users to adjust the space between the
double-stemmed half-notes in tablature:
\new TabStaff {
\tabFullNotation
c4 c2 c4
\override Stem.double-stem-separation = 0.3
c4 c2 c4
}
It also centers the stems on the fret number and adjusts the X-extent
accordingly.
On the tracker:
http://code.google.com/p/lilypond/issues/detail?id=3999
Please review this at https://codereview.appspot.com/110960043/
Affected files (+16, -2 lines):
M lily/stem.cc
M scm/define-grob-properties.scm
M scm/define-grobs.scm
M scm/tablature.scm
Index: lily/stem.cc
diff --git a/lily/stem.cc b/lily/stem.cc
index
39a77a3858fea8ab3d6a7da92df1f26182830439..cc488e312570ede4a4cc6270ab46b110c0431dee
100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -1152,6 +1152,7 @@ ADD_INTERFACE (Stem,
"default-direction "
"details "
"direction "
+ "double-stem-separation "
"duration-log "
"flag "
"french-beaming "
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index
fbb9d679ac50bd06f5eda056093fe3612bfc7772..f5a673a9027816fcabd086ccc5c7c1ae69e04a7c
100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -239,6 +239,10 @@ elements closer together.")
(dot-placement-list ,list? "List consisting of
@code{(@var{description} @var{string-number} @var{fret-number}
@var{finger-number})} entries used to define fret diagrams.")
+ (double-stem-separation ,number? "The distance between the two
+stems of a half note in tablature when using @code{\tabFullNotation},
+not counting the width of the stems themselves, expressed as a multiple
+of the default @code{Staff} staff-space height.")
(duration-log ,integer? "The 2-log of the note head duration,
i.e., @code{0} = whole note, @code{1} = half note, etc.")
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index
572f80f660da0c5edf008246b24ed1c0aa66dedc..84e1283028b221a71840525e0c5824b02ea74abd
100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -2114,6 +2114,7 @@
;; and the extreme minima as abolute minimum length.
(direction . ,ly:stem::calc-direction)
+ (double-stem-separation . 0.5)
(duration-log . ,stem::calc-duration-log)
(length . ,(ly:make-unpure-pure-container ly:stem::calc-length
ly:stem::pure-calc-length))
(neutral-direction . ,DOWN)
Index: scm/tablature.scm
diff --git a/scm/tablature.scm b/scm/tablature.scm
index
36b81106c1bcb0046b9f2a73f5b7f1aab842bacf..bb30664083460e223c2d124b32245c4f972ff9ef
100644
--- a/scm/tablature.scm
+++ b/scm/tablature.scm
@@ -85,7 +85,11 @@
;; 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))))
+ (let* ((single-stem-width (- (cdr X-extent) (car X-extent)))
+ (separation (ly:grob-property grob 'double-stem-separation))
+ (double-stem-width (+ single-stem-width separation))
+ (half-width (/ double-stem-width 2)))
+ (cons (- half-width) half-width))
;; no -> return simple stem width
X-extent)))
@@ -95,7 +99,11 @@
;; 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)
+ (let* ((separation (ly:grob-property grob 'double-stem-separation))
+ (half-separation (/ separation 2)))
+ (ly:stencil-add
+ (ly:stencil-translate-axis stem (- half-separation) X)
+ (ly:stencil-translate-axis stem half-separation X)))
;; no -> draw simple stem
stem)))