Forumsadmin gesucht! Details gibt’s in diesem Thread.

 

Hauptmenü

Chordnames zentrieren funktioniert nicht mehr

Begonnen von Manuela, Freitag, 7. März 2025, 11:23

« vorheriges - nächstes »

Manuela

In diesem Thread wurde mein Problem gelöst.

Leider scheint das nicht mehr zu funktionieren, siehe beigefügtes Beispiel (oder mache ich irgendwas falsch?)

\version "2.25.22"
\language "deutsch"

%\include "C:/Manuela/_lily/_inc.ly"
#(set-global-staff-size 30)

#(define ((chord-name->german-markup-text-alteration B-instead-of-Bb) pitch lowercase?)
   (define (pitch-alteration-semitones pitch)
     (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))

   (define (conditional-string-downcase str condition)
     (if condition
         (string-downcase str)
         str))
   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones  (pitch-alteration-semitones pitch))
          (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -1)))
                   (cons 7 (+ (if B-instead-of-Bb 1 1) alt-semitones))
                   (cons name alt-semitones))))
     (make-line-markup
      (list
       (make-simple-markup
        (conditional-string-downcase
         (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
         lowercase?))
       (let ((alteration (/ (cdr n-a) 2)))
         (cond
          ((and (equal? lowercase? #f) (= alteration FLAT) (= (car n-a) 7)) (make-simple-markup ""))
          ((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) )) (make-simple-markup "s"))
          ((= alteration FLAT) (make-simple-markup "es"))
          ((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2) )) (make-simple-markup "ses"))
          ((= alteration DOUBLE-FLAT) (make-simple-markup "eses"))
          ((= alteration SHARP) (make-simple-markup "is"))
          ((= alteration DOUBLE-SHARP) (make-simple-markup "isis"))
          (else empty-markup)))))))

\paper {
  top-margin = 40\mm
  ragged-right = ##t
  ragged-bottom = ##t
  line-width = 100\mm
  oddFooterMarkup = ##f
  scoreTitleMarkup = ##f
}

\layout {
  \context {
    \ChordNames
    chordRootNamer = #(chord-name->german-markup-text-alteration #f)
  }
}
\markup "default"
mykord = \chordmode { b4:1 es:1 c:1 cis:1 }
<<
  \new ChordNames
  \mykord
  \new RhythmicStaff
  {
    \mykord
  }
>>

\markup "zentriert"
<<
  \new ChordNames
  \mykord
  \new RhythmicStaff
  \with
  {
    \override NoteColumn.before-line-breaking =
    #(lambda (grob)
       (let* ((pap-col (ly:grob-parent grob X))
              (pap-col-elts (ly:grob-object pap-col 'elements))
              (chord-names
               (if (ly:grob-array? pap-col-elts)
                   (filter
                    (lambda (elt)
                      (grob::has-interface elt 'chord-name-interface))
                    (ly:grob-array->list pap-col-elts))
                   '())))
         (for-each
          (lambda (chrd)
            (ly:grob-set-parent! chrd X grob))
          chord-names)))
  }
  {
    \mykord
  }
>>
\markup "Es ist kein Unterschied zu sehen"

Die Chordnames deswegen in deutscher Notation, weil die Nicht-Zentrierung besser zu sehen ist.
Danke für eure Hilfe
viele Grüße
-- Manuela

Manuela

Danke für eure Hilfe
viele Grüße
-- Manuela