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 00:36:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

Le 21/12/2022 à 00:04, Bernard Meylan a écrit :
Est-il possible d'indiquer qqchose comme:

\override BassFigureAlteration.font-name = #"Emmentaler"

afin de retrouver les altérations Emmentaler?



Houlàlà, oui, c'est un vrai problème. Je viens de lui créer une page de bug :

https://gitlab.com/lilypond/lilypond/-/issues/6487

Pour l'instant, je n'ai rien de mieux à vous proposer que ceci, un gros
bout de code tiré du code source et légèrement modifié.

Cordialement,
Jean



\version "2.24.0"

#(define figbass-accidental-alist
  '((-1 . #x1d12b)
    (-1/2 . #x266d)
    (0 . #x266e)
    (1/2 . #x266f)
    (1 . #x1d12a)))

#(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)
               ;;;; ====== Modification pour éviter le changement de police =====
               (make-override-markup
                '(font-name . #f)
                (make-number-markup
                 (ly:wide-char->utf-8
                  (or
                   (assv-ref figbass-accidental-alist alt)
                   (begin
                     (ly:warning
                      (G_ "no accidental glyph found for alteration ~a")
                      alteration)
                     #\?))))))
              #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 -5 fig-markup)
        (make-null-markup))))

\layout {
  \context {
    \Score
    figuredBassFormatter = #modified-format-bass-figure
  }
}



\figures {
  \override BassFigure.font-name = "DejaVu Sans"
  <7+>
}


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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