lilypond-user-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fonte pour basse chiffrée


From: Jean Abou Samra
Subject: Re: Fonte pour basse chiffrée
Date: Wed, 21 Dec 2022 20:08:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

Le 21/12/2022 à 20:05, Bernard Meylan a écrit :

En résumé: le chiffre seul fonctionne, le chiffre avec une altération quelle qu'elle soit aussi, mais l'altération seule provoque le message d'erreur; mais je le répète, le rendu est parfait.



Ça, c'est ce qui arrive quand on va trop vite…


\version "2.24.0"

#(set-global-staff-size 20)

\header {
  % Supprimer le pied de page par défaut
  tagline = ##f
}

#(define figbass-accidental-alist
  '((-1 . "accidentals.flatflat")
    (-1/2 . "accidentals.flat")
    (0 . "accidentals.natural")
    (1/2 . "accidentals.sharp")
    (1 . "accidentals.doublesharp")))

#(define (modified-format-bass-figure figure event context)
  (let* (;; User properties controlling the figured bass layout.
         (large-number-alignment
          (ly:context-property context 'figuredBassLargeNumberAlignment))
         (figbass-alist
          (ly:context-property context 'figuredBassPlusStrokedAlist))
         (alt-dir
          (ly:context-property context 'figuredBassAlterationDirection))
         (plus-dir
          (ly:context-property context 'figuredBassPlusDirection))

         (augmented (ly:event-property event 'augmented))

         ;; The digit(s), horizontally positioned, or #f.
         (fig-markup
          (if (number? figure)
              ((if (<= 10 figure)
                   (lambda (y)
                     (make-align-on-other-markup
                      X
                      large-number-alignment (make-number-markup "1")
                      large-number-alignment y))
                   identity)
               (cond
                ((eq? #t (ly:event-property event 'diminished))
                 (make-slashed-digit-markup figure))
                ((eq? #t (ly:event-property event 'augmented-slash))
                 ;; Use specially stroked digit if available and wanted.
                 (or (and-let* (((<= 6 figure 9))
                                (glyph (assv-ref figbass-alist figure)))
                       (make-musicglyph-markup glyph))
                     (make-backslashed-digit-markup figure)))
                ((eq? #t augmented)
                 ;; Use special digit with plus if available and wanted.
                 (or (and-let* (((>= 5 figure 2))
                                ((eqv? plus-dir RIGHT))
                                (glyph (assv-ref figbass-alist figure)))
                       (set! augmented #f)
                       (make-musicglyph-markup glyph))
                     (make-number-markup (number->string figure 10))))
                (else (make-number-markup (number->string figure 10)))))
              #f))

         (alt (ly:event-property event 'alteration))
         (alt-bracket (ly:event-property event 'alteration-bracket #f))
         ;; The alteration, probably bracketed but not positioned yet,
         ;; or #f.
         (alt-markup
          (if (number? alt)
              ((if alt-bracket make-bracket-markup identity)
               (let ((glyph
                      (or (assv-ref figbass-accidental-alist alt)
                          (begin
                            (ly:warning
                             (G_ "no accidental glyph found for alteration ~a")
                             alteration)
                            #\?))))
                 ;;; ====== À ajuster ==========
                 #{
                   \markup
                   \override #'(font-name . #f)
                   \fontsize #-3
                   \align-on-other #Y #CENTER #(or fig-markup #{ \markup \number "1" #}) #CENTER
                   \musicglyph #glyph
                 #}))
              #f))

         (plus-markup (if (eq? #t augmented)
                          (make-number-markup "+")
                          #f)))

    (if (and (not alt-markup) alt-bracket)
        (ly:programming-error
         "Cannot put brackets around non-existent bass figure alteration."))

    ;; We treat a solitary alteration similarly to digits.
    (if (and (not fig-markup) alt-markup)
        (begin
          (set! fig-markup
                (make-align-on-other-markup
                 X
                 CENTER (make-number-markup "1")
                 CENTER alt-markup))
          (set! alt-markup #f)))

    ;; We treat a solitary plus similarly to digits (but enlarged).
    (if (and (not fig-markup) plus-markup)
        (begin
          (set! fig-markup
                (make-align-on-other-markup
                 Y
                 CENTER (make-number-markup "1")
                 CENTER (make-align-on-other-markup
                         X
                         CENTER (make-number-markup "1")
                         CENTER (make-fontsize-markup 3 plus-markup))))
          (set! plus-markup #f)))

    ;; The alteration gets attached either to the left or the right of
    ;; the digit(s).
    (if alt-markup
        (set! fig-markup
              (make-put-adjacent-markup
               X (if (number? alt-dir)
                     alt-dir
                     LEFT)
               fig-markup
               (make-pad-x-markup 0.1 alt-markup))))

    ;; Ditto for the plus mark.
    (if plus-markup
        (set! fig-markup
              (if fig-markup
                  (make-put-adjacent-markup
                   X (if (number? plus-dir)
                         plus-dir
                         LEFT)
                   fig-markup plus-markup)
                  plus-markup)))

    (if (markup? fig-markup)
        (make-fontsize-markup 0 fig-markup)
        (make-null-markup))))

global = {
  \key c \major
  \time 4/4
}

bcMusic = \relative c {
  \global
  c4 c c d e2 d

}

bcFigures = \figuremode {
  \global
  \set figuredBassAlterationDirection = #RIGHT
  \override BassFigure.font-name = #"Garamond Premier Pro"
  % \override BassFigure.font-size = #2

  <4>4 <4+> <_->

}

\score {
  <<
    \new FiguredBass \bcFigures
    \new Staff { \clef bass \bcMusic }
  >>
  \layout {
    \context {
      \Score
      figuredBassFormatter = #modified-format-bass-figure
    }
  }
}





Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]