Re: [tablatures] tremolos in tablature

[ Thread Index | Date Index | More lilynet.net/tablatures Archives ]


Marc Hohl schrieb:
Neil Puttock schrieb:
On 28 August 2010 16:17, Carl Sorensen <c_sorensen@xxxxxxx> wrote:

Why not use 1/staff-space?  This would adjust things regardless of how
staff-space was tweaked, wouldn't it?

Yes.  A simple helper function using ly:staff-symbol-staff-space would
suffice (apart from 'beam-width, which needs a wrapper around
ly:stem-tremolo::calc-width).
Thanks you both for your answers, I'll try to include all your proposals.
I think uploading to Rietveld does now make more sense, what do you think?
Adding just <10 lines to the code, I just send you another patch directly.

Marc

From 5bff0c603dae1c8984a6e9837dbae9ab71cbae5c Mon Sep 17 00:00:00 2001
From: Marc Hohl <marc@xxxxxxxxxx>
Date: Tue, 24 Aug 2010 14:46:45 +0200
Subject: [PATCH] Tablature: support StemTremolo correctly

---
 ly/engraver-init.ly |    9 +++++++++
 ly/property-init.ly |    1 +
 scm/tablature.scm   |    8 ++++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 6ecba2d..22e588c 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -725,6 +725,14 @@ context."
   %% too big. We have to adjust the beam settings:
   \override Beam #'beam-thickness = #0.32
   \override Beam #'length-fraction = #0.62
+  %% the same goes for tremolo beams
+  \override StemTremolo #'beam-thickness = #0.32
+  %% NOTE: in lily/stem-tremolo.cc, we have length-fraction = 1,
+  %% and the tablature staff space is scaled (1.5 by default),
+  %% so we use the inversion of the scale factor:
+  \override StemTremolo #'length-fraction = #(lambda (grob)
+                                               (/ 1 (ly:staff-symbol-staff-space grob)))
+  \override StemTremolo #'beam-width = #stem-tremolo::calc-tab-width
 
   %% No accidental in tablature !
   \remove "Accidental_engraver"
@@ -744,6 +752,7 @@ context."
   autoBeaming = ##f
   %% remove beams, dots and rests ...
   \override Beam #'stencil = ##f
+  \override StemTremolo #'stencil = ##f
   \override Dots #'stencil = ##f
   \override Rest #'stencil = ##f
   \override MultiMeasureRest #'stencil = ##f
diff --git a/ly/property-init.ly b/ly/property-init.ly
index 0b1f2a2..5a60e0e 100644
--- a/ly/property-init.ly
+++ b/ly/property-init.ly
@@ -415,6 +415,7 @@ tabFullNotation = {
   \revert NoteColumn #'ignore-collision
   % beams, dots
   \revert TabVoice.Beam #'stencil
+  \revert TabVoice.StemTremolo #'stencil
   \revert TabVoice.Dots #'stencil
   \revert TabVoice.Tie #'stencil
   \revert TabVoice.Tie #'after-line-breaking
diff --git a/scm/tablature.scm b/scm/tablature.scm
index 71b453c..2c33528 100644
--- a/scm/tablature.scm
+++ b/scm/tablature.scm
@@ -248,3 +248,11 @@
 
     (ly:grob-set-property! grob 'control-points new-control-points)
     (ly:slur::print grob)))
+
+;; for \tabFullNotation, the stem tremolo beams are too big in comparison to
+;; normal staves; this wrapper function scales accordingly:
+(define-public (stem-tremolo::calc-tab-width grob)
+  (let* ((width (ly:stem-tremolo::calc-width grob))
+         (staff-space (ly:staff-symbol-staff-space grob)))
+        (/ width staff-space)))
+
-- 
1.5.4.3



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/