Hi Bruno,

to avoid creating a new markup from scratch you can use LSR snippet no. 869 <http://lsr.di.unimi.it/LSR/Item?id=869> to modify the default. Example attached.

Yours best,
Simon

Am 17.07.2015 um 01:19 schrieb Bruno Ruviaro:
Hi all,

This is my first post on this list, and my first week using Lilypond for a real project. Learning a lot in a compressed amount of time... ;-)

I am trying to get metronome markings with "ca." before the number, but without bold face characters. How can I cancel the bold face font inside a \tempo command?

The snippet below shows what I've got so far. Bar 2 is what I'm getting by using \markup inside \tempo. Bar 3 shows what I would like to get. I'm happy to use Bar 3 solution if that's the only way, but I suppose there is a solution from inside \tempo?

Thanks for any tips!

Bruno

% ===========

\version "2.18.2"

melody = \relative c'' {
  % regular
  \tempo 4=120
  % using markup inside tempo
  % characters are printed in bold face
  c4 d e f
   \tempo \markup {
    \concat {
      \smaller \general-align #Y #DOWN \note #"4" #1
      " = "
      \italic ca.
      \hspace #0.25
      "120"
    }
  }
  c d e f

  % not using tempo to avoid bold face
  c^\markup {
    \concat {
      \smaller \general-align #Y #DOWN \note #"4" #1
      " = "
      \italic ca.
      \hspace #0.25
      "120"
    }
  }
  d e f
  c d e f
}

\score {
    \new Staff { \melody }
  \layout { }
}




_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

% courtesy of ArnoldTheresius, LSR 869
\version "2.17.97"

#(define-public (format-metronome-markup-approx event context)
  (let ((eq-sym-def (ly:context-property context 'tempoEquationText))           
  ; added option
        (hide-paren (eq? #t (ly:context-property context 
'tempoHideParenthesis))) ; added option
        (num-color (ly:context-property context 'tempoNumberColor #f))          
  ; added option
        (hide-note (ly:context-property context 'tempoHideNote #f))
        (text (ly:event-property event 'text))
        (dur (ly:event-property event 'tempo-unit))
        (count (ly:event-property event 'metronome-count)))
    (metronome-markup-approx text dur count hide-note eq-sym-def hide-paren 
num-color)))

#(define-public (metronome-markup-approx text dur count hide-note eq-sym-def 
hide-paren col)
  (let* ((note-mark (if (and (not hide-note) (ly:duration? dur))
                        (make-smaller-markup
                         (make-note-by-number-markup (ly:duration-log dur)
                                                     (ly:duration-dot-count dur)
                                                     1))
                        #f))
         (count-markup (cond ((number? count)
                              (if (> count 0)
                                  (make-simple-markup (number->string count))
                                  #f))
                             ((pair? count)
                              (make-concat-markup
                               (list
                                (make-simple-markup (number->string (car 
count)))
                                (make-simple-markup (ly:wide-char->utf-8 
#x2009))
                                (make-simple-markup (ly:wide-char->utf-8 
#x2013))
                                (make-simple-markup (ly:wide-char->utf-8 
#x2009))
                                (make-simple-markup (number->string (cdr 
count))))))
                             (else #f)))
         (note-markup (if (and (not hide-note) count-markup)
                          (make-concat-markup
                           (list
                            (make-general-align-markup Y DOWN note-mark)
                            (make-simple-markup " ")
                            (make-simple-markup (if (string? eq-sym-def)
                                                 eq-sym-def
                                                 (ly:wide-char->utf-8 #x2248)))
                            (make-simple-markup " ")
                            (if (eq? col #f)
                             count-markup
                             (make-with-color-markup col count-markup))))
                          #f))
         (text-markup (if (not (null? text))
                          (make-bold-markup text)
                          #f)))
    (if text-markup
        (if (and note-markup (not hide-note))
            (make-line-markup (list text-markup
                                   (if hide-paren
                                    note-markup
                                    (make-concat-markup
                                     (list (make-simple-markup "(")
                                           note-markup
                                           (make-simple-markup ")"))))))
            (make-line-markup (list text-markup)))
        (if note-markup
            (make-line-markup (list note-markup))
            (make-null-markup)))))



% Make this new formatter the default:
\layout {
  \context {
    \Score
    metronomeMarkFormatter = #format-metronome-markup-approx
  }
}

#(define (define-translator-property symbol type? description)
  (if (not (and (symbol? symbol)
        (procedure? type?)
        (string? description)))
      (ly:error "error in call of define-translator-property"))
  (if (not (equal? (object-property symbol 'translation-doc) #f))
      (ly:error (_ "symbol ~S redefined") symbol))

  (set-object-property! symbol 'translation-type? type?)
  (set-object-property! symbol 'translation-doc description)
  symbol)

#(for-each
  (lambda (x)
    (apply define-translator-property x))
    `((tempoHideParenthesis
       ,boolean?
       "Hide the parenthesis around the metronome markup with text")
      (tempoEquationText
       ,string?
       "initially ''='' in the metronome markup, but here the default is 
altered to ''≈''")
      (tempoNumberColor
       ,list?
       "alternate color, in which the tempo value should be displayed")))
\version "2.19.23"
\include "tempo-approx.ily"

{
  \set Score.tempoEquationText = "= ca."
  \tempo 4=120
  c'4
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to