X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fsnippets%2Fbar-chords-notation-for-guitar-with-text-spanner.ly;fp=Documentation%2Fsnippets%2Fbar-chords-notation-for-guitar-with-text-spanner.ly;h=d0028da2a825df1d042b0912378a7e32c5eb00b8;hb=3af0951f9a11677240efa6228683dd4fcea13eaf;hp=0000000000000000000000000000000000000000;hpb=652ed35a2013489d0a14fede6307cd2595abb2c4;p=lilypond.git diff --git a/Documentation/snippets/bar-chords-notation-for-guitar-with-text-spanner.ly b/Documentation/snippets/bar-chords-notation-for-guitar-with-text-spanner.ly new file mode 100644 index 0000000000..d0028da2a8 --- /dev/null +++ b/Documentation/snippets/bar-chords-notation-for-guitar-with-text-spanner.ly @@ -0,0 +1,74 @@ +%% DO NOT EDIT this file manually; it is automatically +%% generated from LSR http://lsr.di.unimi.it +%% Make any changes in LSR itself, or in Documentation/snippets/new/ , +%% and then run scripts/auxiliar/makelsr.py +%% +%% This file is in the public domain. +\version "2.18.0" + +\header { + lsrtags = "chords, fretted-strings" + + texidoc = " +Here is how to print bar chords (or barre chords) or half-bar chords +(just uncomment the appropriate line for to select either one). The +syntax is : @code{\\bbarre #'fret_number' note(s)} + + + + + + +" + doctitle = "Bar chords notation for Guitar (with Text Spanner)" +} % begin verbatim + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %%%%%%% Cut here ----- Start 'bbarred.ly' + +%% C with slash ------------------------------- +cWithSlash = \markup { + \combine \roman C \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0) +} +%% Span ----------------------------------- +%% Syntax: \bbarre #"text" { notes } - text = any number of box +bbarre = +#(define-music-function (barre location str music) (string? ly:music?) + (let ((elts (extract-named-music music '(NoteEvent EventChord)))) + (if (pair? elts) + (let ((first-element (first elts)) + (last-element (last elts))) + (set! (ly:music-property first-element 'articulations) + (cons (make-music 'TextSpanEvent 'span-direction -1) + (ly:music-property first-element 'articulations))) + (set! (ly:music-property last-element 'articulations) + (cons (make-music 'TextSpanEvent 'span-direction 1) + (ly:music-property last-element 'articulations)))))) + #{ + \once \override TextSpanner.font-size = #-2 + \once \override TextSpanner.font-shape = #'upright + \once \override TextSpanner.staff-padding = #3 + \once \override TextSpanner.style = #'line + \once \override TextSpanner.to-barline = ##f + \once \override TextSpanner.bound-details = + #`((left + (text . ,#{ \markup { \draw-line #'( 0 . -.5) } #}) + (Y . 0) + (padding . 0.25) + (attach-dir . -2)) + (right + (text . ,#{ \markup { \cWithSlash #str } #}) + (Y . 0) + (padding . 0.25) + (attach-dir . 2))) +%% uncomment this line for make full barred + % \once \override TextSpanner.bound-details.left.text = \markup{"B" #str} + $music + #}) + +%% %%%%%%% Cut here ----- End 'bbarred.ly' +%% Copy and change the last line for full barred. Rename in 'fbarred.ly' +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Syntaxe: \bbarre #"text" { notes } - text = any number of box +\relative c'{ \clef "G_8" \stemUp \bbarre #"III" { 16[ c' d c d8] } }