| Re: [tablatures] tremolos in tablature | 
[ Thread Index | 
Date Index
| More lilynet.net/tablatures Archives
] 
- To: Neil Puttock <n.puttock@xxxxxxxxx>
 
- Subject: Re: [tablatures] tremolos in tablature
 
- From: Marc Hohl <marc@xxxxxxxxxx>
 
- Date: Mon, 30 Aug 2010 16:17:52 +0200
 
- Cc: Carl Sorensen <c_sorensen@xxxxxxx>,  Patrick Schmidt <p.l.schmidt@xxxxxx>, "tablatures@xxxxxxxxxxx" <tablatures@xxxxxxxxxxx>
 
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1283177875; l=4644;	s=domk; d=hohlart.de;	h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:	Date:X-RZG-CLASS-ID:X-RZG-AUTH;	bh=5qg88pVci0qZ365sAoIf6mFH2YM=;	b=WaAbNCPBVQqFwQsna65bbd50vZQI6oeTNCQBKg3kG0gTtPA+sR9xCgx0jr9uB0WHcKO	9VsruS+l2LHEvslrkLOQeS2WI0HJliKndlePuMXnr2j0G0a7uT9Cj/euvkXs+5KjiF/hu	XmrQcA/zB5UUVM8dyiD2KUkBHcn12r45Ciw=
 
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