From: Han-Wen Nienhuys Date: Wed, 14 Aug 2002 12:45:44 +0000 (+0000) Subject: * scm/output-lib.scm: Support of hammers and pulls in tablature X-Git-Tag: release/1.5.73~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=818b830dd1b600e497cb034b4727c97ad6ee7765;p=lilypond.git * scm/output-lib.scm: Support of hammers and pulls in tablature -- Hammers and pulls are inserted exactly like slurs, and a "H" or a "P" is added over the slur as needed. The file * ./input/test/tablature-hammer.ly: example of hammer, pull and legato in a tablature. * ly/engraver-init.ly: Stem.up-to-staff is now disabled by default, since it appears that most of the published tablatures are not like that. --- diff --git a/ChangeLog b/ChangeLog index 0ef0d168ee..75b33f2d0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2002-08-14 Han-Wen Nienhuys + + * scm/output-lib.scm: Support of hammers and pulls in tablature + -- Hammers and pulls are inserted exactly like slurs, and a "H" or + a "P" is added over the slur as needed. The file + + * ./input/test/tablature-hammer.ly: example of hammer, pull and + legato in a tablature. + + * ly/engraver-init.ly: Stem.up-to-staff is now disabled by + default, since it appears that most of the published tablatures + are not like that. + +2002-08-13 Han-Wen Nienhuys + + * lily/beam.cc (brew_molecule): use + Staff_symbol_referencer::staff_space for thickness. + 2002-08-14 Jan Nieuwenhuizen * Documentation/user/lilypond.tely: Add dir entries for @@ -80,7 +98,7 @@ (set_stem_shorten): Integer divide bug fix. * input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: Really expect - 6 systems, change warning into error. + six systems, change warning into error. * scm/grob-description.scm (beamed-stem-shorten): Shorten 8th beams same as normal stem (one staffspace), high order beams less diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 5cf541e666..bd0cb0913b 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -148,9 +148,9 @@ engraving. It is a recurring theme with many variations. One of these variations is choosing spacing. The distances between notes should reflect the durations between notes, but adhering with mathematical precision to the duration will lead to a poor result. Shown here is an -example of a motive, printed four times. It is printed using both -exact, mathematical spacing, and with some corrections. Can you spot -which is which? +example of a motive, printed twice. It is printed using both exact, +mathematical spacing, and with some corrections. Can you spot which is +which? @c I can only see the motive printed two times!!! /Mats diff --git a/input/test/tablature-hammer.ly b/input/test/tablature-hammer.ly new file mode 100644 index 0000000000..9648592888 --- /dev/null +++ b/input/test/tablature-hammer.ly @@ -0,0 +1,14 @@ +\version "1.5.68" +\header { +texidoc = "" +} + +\score{ + \context TabStaff < + \notes\relative c''{ + c()d + d()d + d()c + } + > +} diff --git a/lily/beam.cc b/lily/beam.cc index 5f19968e65..4fd696937b 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -316,7 +316,8 @@ Beam::brew_molecule (SCM grob) Real dy = pos.delta (); Real dydx = dy && dx ? dy/dx : 0; - Real thick = gh_scm2double (me->get_grob_property ("thickness")); + Real thick = gh_scm2double (me->get_grob_property ("thickness")) + * Staff_symbol_referencer::staff_space (me); Real bdy = get_beam_translation (me); SCM last_beaming = SCM_EOL;; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 5577f513b2..3a869f7e39 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -464,9 +464,14 @@ TabVoiceContext = \translator { \denies "Thread" \consists "Tab_note_heads_engraver" + Slur \override #'font-family = #'roman + Slur \override #'molecule-callback = #hammer-molecule-callback + Slur \override #'direction = #-1 + % Draws all stems/beams out of the staff (and not in the middle of the staff !) - Beam \override #'damping = #100000 - Stem \override #'up-to-staff = ##t + % This feature is now disabled because most of the tab does not use it. + %Beam \override #'damping = #100000 + %Stem \override #'up-to-staff = ##t % No accidental in tablature ! \remove Accidental_engraver diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 52baf2e1be..58ec903adc 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -35,6 +35,38 @@ ) ) +(define (hammer-molecule-callback grob) + (let* ((note-collums (ly-get-grob-property grob 'note-columns)) + (note-column1 (cadr note-collums)) + (note-column2 (car note-collums)) + (note1 (car (ly-get-grob-property note-column1 'note-heads))) + (note2 (car (ly-get-grob-property note-column2 'note-heads))) + (fret1 (string->number (ly-get-grob-property note1 'text))) + (fret2 (string->number (ly-get-grob-property note2 'text))) + (letter (if (< fret1 fret2) "H" + (if (> fret1 fret2) "P" + ""))) + ) + (let ((slur (Slur::brew_molecule grob)) + (text (fontify-text (ly-get-default-font grob) letter))) + + (let ((x (/ (- (cdr (ly-get-molecule-extent slur 0)) + (/ (cdr (ly-get-molecule-extent text 0)) 2.0) + ) + -2.0))) + + (ly-set-molecule-extent! text 0 (cons x x)) + (ly-align-to! text 0 1) + ) + + (ly-combine-molecule-at-edge slur 1 1 text -0.6) + ) + ) + ) + + + + ; end of tablature functions