Deutsches Lilypond Forum (Archiv)

Allgemein => Fragen zu Funktionen => Thema gestartet von: iugin am Mittwoch, 5. November 2014, 08:00

Titel: Klammern für Einsätze drucken
Beitrag von: iugin am Mittwoch, 5. November 2014, 08:00
Hallo miteinander

ich komme wieder mit vielen Fragen :)
Was ich derzeit versuche, ist eine Orchesterpartitur so zu bezeichnen, wie ich vom Hand machen würde, inkl. Einsätze und so.
Ich konnte die Einsätze eintragen, es gibt aber ein paar Probleme.
Zuerst mal den Code:
\version "2.18.2"

#(define-markup-command (left-bracket-up layout props) ()
   (ly:make-stencil
    `(path 0.7
       `(rmoveto -.5 -3
          lineto -.5 4
          lineto 1 4
          ))))

#(define-markup-command (left-bracket-down layout props) ()
   (ly:make-stencil
    `(path 0.7
       `(rmoveto -.5 3
          lineto -.5 -4
          lineto 1 -4
          ))))

leftBracket = #(define-music-function (parser location direction)(number?)
                 #{
                   #(if (= 1 direction)
                        #{\once\override BreathingSign.text = #(make-left-bracket-up-markup)#}
                        #{\once\override BreathingSign.text = #(make-left-bracket-down-markup)#}
                        )
                   \once\override BreathingSign.break-visibility = #end-of-line-invisible
                   \once\override BreathingSign.Y-offset = ##f
                   \once\override BreathingSign.color = #(x11-color 'red)
                   \breathe
                 #})

addMarkup = #(define-music-function (parser location text direction note-event)
               (string? number? ly:music?)
               (set! (ly:music-property note-event 'articulations)
                     (cons (make-music 'TextScriptEvent
                             'direction
                             1
                             'text
                             (markup
                              (#:whiteout
                               (#:with-color
                                (list 1.0 0.0 0.0)
                                (#:pad-markup 0
                                  (#:huge
                                   (#:line
                                    (#:halign 3
                                     (#:override
                                      (cons (quote font-name) "Vera Bold")
                                      text)))))))))
                       (ly:music-property note-event 'articulations)))
               note-event)


einsatz = #(define-music-function (parser location text direction note )
             (string? number? ly:music?)
             #{               
               \leftBracket $direction
               \addMarkup $text $direction $note               
             #}
             )


{
  \new Staff \relative c' {
    c4 d \einsatz #"A" #1 e d
  } 
}
{
  \new Staff \relative c' {
    c4 d \einsatz #"Vl1" #1 eis d
  } 
}
{
  \new Staff \relative c''' {
    c4 d \einsatz #"Vl1" #1 eis d
  } 
}
Die Idee, das \breath-Zeichen zu verwenden habe ich von hier (http://lsr.di.unimi.it/LSR/Snippet?id=377).
Ich wollte ursprünglich das Arpeggio-Zeichen benutzen, weil ich es durch mehrere Systeme ziehen kann, hatte aber eine Menge Probleme, weil ich nicht genau wusste, wie ich das Zeichen in einen dicken Klammer hätte ändern können, und weil vor einer einziger Note nicht gedruckt wurde.

Jetzt die Fragen:

Besten Dank für eure Antworten und einen schönen Tag!

Liebe Grüsse

Eugenio
Titel: Re: Klammern für Einsätze drucken
Beitrag von: iugin am Mittwoch, 5. November 2014, 19:19
Hallo miteinander!

Ein Problem ist (fast) gelöst. Wenn ich die Funktion addMarkup so verändere, kann ich den Text ausrichten, zumindest bis 4 Buchstaben. Aber ein Kürzel wird kaum länger sein. :)
addMarkup = #(define-music-function (parser location text direction note-event)
               (string? number? ly:music?)
               (define ch (string-length text))
               (set! (ly:music-property note-event 'articulations)
                     (cons (make-music 'TextScriptEvent
                             'direction
                             1
                             'text
                             (markup
                              (#:whiteout
                               (#:with-color
                                (list 1.0 0.0 0.0)
                                 (#:pad-markup 0
                                  (#:huge
                                   (#:line
                                    (#:halign (/ (- 7 ch) 2)
                                     (#:override
                                      (cons (quote font-name) "Vera Bold")
                                      text)))))))))
                       (ly:music-property note-event 'articulations)))
               note-event)
Es bleiben die andere zwei Probleme... mal sehen :)

Ich wünsche dem Forum einen schönen Abend

Eugenio
Titel: Re: Klammern für Einsätze drucken
Beitrag von: iugin am Mittwoch, 5. November 2014, 22:38
Zweites Problem auch (fast) gelöst:
#(define-markup-command (left-bracket-up layout props) ()
   (ly:make-stencil
    `(path 0.7
       `(rmoveto -.5 -3
          lineto -.5 4
          lineto 1 4
          ))
    '(-1 . 1)
    '(0 . 0)))
Die letzte zwei Paare geben anscheinend die Grösse vom Stencil:
Zitat
Function: ly:make-stencil expr xext yext

    Stencils are a device independent output expressions.They carry two pieces of information:

    1: a specification of how to print this object. This specification is processed by the output backends, for example scm/output-ps.scm.

    2: the vertical and horizontal extents of the object.

    If the extents are unspecified, they are taken to be empty.
Jetzt stimmt die Position von den Kürzeln nicht mehr, ist aber keine grosse Sache... Ich muss nur ein bisschen mit den Zahlen jonglieren.

Schönen Abend allerseits

Eugenio