lilypond-user
[Top][All Lists]
Advanced

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

Re: [LilyJAZZ] MetronomeMark.style broken in 2.19.0?


From: Thomas Morley
Subject: Re: [LilyJAZZ] MetronomeMark.style broken in 2.19.0?
Date: Sun, 9 Feb 2014 19:52:54 +0100

2014-02-09 11:31 GMT+01:00 Marc Hohl <address@hidden>:
> Hi list,
>
> I use LilyJAZZ in one of my latest projects. Thanks to Harm's patch,
> it was possible to use the Jazz font in tempo markings, but this
> seems to be broken:
[...]

Hi Marc,

the commit-message says:

    format-metronome-mark and metronome-markup don't support styles other than d

    issue 3096

    - introducing 'styled-metronome-markup' with the (currently quite
    theoretical) possibility to use another font here. For now
    the font-argument is used only to make
      \override MetronomeMark #'font-name = ...
    possible.

    - adding 'flag-style to define-grob-properties.scm, the
    MetronomeMark-properties in define-grobs.scm and in text-interface.cc

    - adding a regtest for different 'metronomeMarkFormatter'.

    It's now possible to override MetronomeMark with 'style, 'flag-style and
    'font-name to customize the appearance.

Maybe I was not clear enough.
Overriding style for flags and note-heads is possible _only_ if the
_default_ font for them is used.
I tried to prepare the possibility to use another font for
flags/noteheads as soon as LilyPond can handle them. "the (currently
quite theoretical) possibility"
The font for LilyJazz isn't really accepted by LilyPond, it is
inserted with sort of a workaround.
Therefore overriding MetronomeMark style/flag-style is ignored, when
'jazz is used.

Well, it's possible to extend it a bit:

\version "2.19.1"

\include "LilyJAZZ.ily"

\include "ignatzek-jazz-chords.ily"

\include "markup-jazz-note-by-number.ly"

#(define*-public
  ((styled-metronome-markup
     #:optional (glyph-font 'default)(note-head-flag '(default . default)))
     event context)
   (let ((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 glyph-font note-head-flag text dur count hide-note)))

#(define (metronome-markup glyph-font note-head-flag text dur count hide-note)
  (let* ((note-mark
            (if (and (not hide-note) (ly:duration? dur))
                (make-smaller-markup
                   ;; We insert the (default)-font for flag-glyphs and
                   ;; note-head-glyphs to prepare the possibility to use
                   ;; other fonts and to make possible using
                   ;; \override MetronomeMark #'font-name = #<font-name>
                   ;; without affecting the note/flag-glyphs.
                   (make-override-markup (cons 'font-name glyph-font)
                   ;; The following 2 lines were inserted,
                   ;; Also, 'note-head-flag' was made available as an argument
                   ;; in 'metronome-markup' and 'styled-metronome-markup'
                    (make-override-markup `(style . ,(car note-head-flag))
                     (make-override-markup `(flag-style . ,(cdr note-head-flag))
                       (make-note-by-number-markup
                           (ly:duration-log dur)
                           (ly:duration-dot-count dur)
                           UP)))))
                         #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 " ")
                                (make-simple-markup "–")
                                (make-simple-markup " ")
                                (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 "=")
                            (make-simple-markup " ")
                            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
                                    (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)))))

%% default:
#(define-public format-metronome-markup
  (styled-metronome-markup))

#(define-public jazz-metronome-markup
  (styled-metronome-markup 'default '(jazz . jazz)))

#(define-public my-format-metronome-markup
  (styled-metronome-markup 'default '(diamond . old-straight-flag)))


\header {
  title =
  \markup {
    \fontsize #3
    \override #'(font-name . "LilyJAZZ Text")
    "Some LillyJAZZ-testing"
  }
}

\layout {
  indent = 0
  \context {
    \Score
    metronomeMarkFormatter = #jazz-metronome-markup
  }
}

<<
  %% "Text_engraver" is inserted for some comments only, delete it
  %% and \notemode { ... }
  \new ChordNames \with { \consists "Text_engraver" }
  \chordmode {
    c2:5- d:sus4.9+ e f g a
    \notemode { s^\markup \fontsize #-3 "Some crazy testing:" }
    b:m5-.6+.7.9-.11+.13+
  }

  \new Staff
  \relative c' {
    \jazzOn
    \key cis\major
    ces dis e f g a b b
  }
>>

\new Staff
  \new Voice \with {
    \consists "Pitch_squash_engraver"
  }
  \relative c' {
    \jazzOn
    \numericTimeSignature
    \override Score.MetronomeMark.font-name = "LilyJAZZText"
    \tempo "Tempo 1" 16=120-140
    e8 e g a a16( bes) a8 g
    \improvisationOn
    e8 ~
    \tempo "Tempo 2" 32 = 168
    e2 ~ e8 f4 f8 ~
    f1 ~
    f2
    \improvisationOff
    \override Score.MetronomeMark.font-name = "Purisa"
    \set Score.metronomeMarkFormatter = #my-format-metronome-markup
    \tempo "Tempo 1" 32=180-200
    a16( bes) a8 g e
    \jazzOff
  }

\score {
   \new Staff {
     \jazzOn
     \override Score.MetronomeMark.font-name = "LilyJAZZText"
     \tempo "Slowly" 2 = 60 c'1
   }
}

I'm not sure which version of the LilyJazz code you use.
There are so many around. I even got confused on my own computer.
I append the ones I included above.


HTH,
  Harm

Attachment: ignatzek-jazz-chords.ily
Description: Binary data

Attachment: LilyJAZZ.ily
Description: Binary data

Attachment: markup-jazz-note-by-number.ly
Description: Text Data


reply via email to

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