]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/bar-chords-notation-for-guitar--with-text-spanner.ly
Doc: run makelsr locally
[lilypond.git] / Documentation / snippets / bar-chords-notation-for-guitar--with-text-spanner.ly
1 % DO NOT EDIT this file manually; it is automatically
2 % generated from Documentation/snippets/new
3 % Make any changes in Documentation/snippets/new/
4 % and then run scripts/auxiliar/makelsr.py
5 %
6 % This file is in the public domain.
7 %% Note: this file works from version 2.15.30
8 \version "2.15.30"
9
10 \header {
11 %% Translation of GIT committish: b482c3e5b56c3841a88d957e0ca12964bd3e64fa
12   texidoces = "
13 He aquí cómo imprimir acordes con cejilla o con media cejilla (quite
14 la marca de comentario de la línea adecuada para seleccionar uno de
15 ellos).
16
17 La sintaxis es @code{\\bbarre #\"@var{número de traste}\" @{ notas @} }.
18
19 "
20   doctitlees = "Notación de acordes de cejilla para guitarra (con elemento de extensión de texto)"
21
22   lsrtags = "chords, fretted-strings"
23
24   texidoc = "
25 Here is how to print bar chords, or half-bar chords (just uncomment the
26 appropriate line for to select either one).
27
28 The syntax is @code{\\bbarre #\"@var{fret number}\" @{ notes @} }.
29 "
30   doctitle = "Bar chords notation for Guitar (with Text Spanner)"
31 } % begin verbatim
32
33
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %% %%%%%%%  Cut here ----- Start 'bbarred.ly'
36
37 %% C with slash -------------------------------
38 cWithSlash = \markup {
39   \combine \roman C \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0)
40 }
41 %% Span -----------------------------------
42 %% Syntax: \bbarre #"text" { notes } - text = any number of box
43 bbarre =
44 #(define-music-function (barre location str music) (string? ly:music?)
45    (let ((elts (extract-named-music music '(NoteEvent EventChord))))
46      (if (pair? elts)
47          (let ((first-element (first elts))
48                (last-element (last elts)))
49            (set! (ly:music-property first-element 'articulations)
50                  (cons (make-music 'TextSpanEvent 'span-direction -1)
51                        (ly:music-property first-element 'articulations)))
52            (set! (ly:music-property last-element 'articulations)
53                  (cons (make-music 'TextSpanEvent 'span-direction 1)
54                        (ly:music-property last-element 'articulations))))))
55    #{
56        \once \override TextSpanner #'font-size = #-2
57        \once \override TextSpanner #'font-shape = #'upright
58        \once \override TextSpanner #'staff-padding = #3
59        \once \override TextSpanner #'style = #'line
60        \once \override TextSpanner #'to-barline = ##f
61        \once \override TextSpanner #'bound-details =
62             #`((left
63                 (text . ,#{ \markup { \draw-line #'( 0 . -.5) } #})
64                 (Y . 0)
65                 (padding . 0.25)
66                 (attach-dir . -2))
67                (right
68                 (text . ,#{ \markup { \cWithSlash #str } #})
69                 (Y . 0)
70                 (padding . 0.25)
71                 (attach-dir . 2)))
72 %% uncomment this line for make full barred
73        % \once  \override TextSpanner #'bound-details #'left #'text =  \markup { "B" #str }
74        $music
75    #})
76
77 %% %%%%%%%  Cut here ----- End 'bbarred.ly'
78 %% Copy and change the last line for full barred. Rename in 'fbarred.ly'
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80
81 %% Syntaxe: \bbarre #"text" { notes } - text = any number of box
82 \relative c'{ \clef "G_8" \stemUp \bbarre #"III" { <f a'>16[  c' d c d8] } }