microtherion / lilyjazz2

Packaging the lilyjazz 2.0 fonts and stylesheets for lyp
Other
2 stars 1 forks source link

Chord letters from lilyjazz-text and symbols from lilyjazz-chord #3

Open baloe opened 5 years ago

baloe commented 5 years ago

Thank you for resolving the Major7 triangle issue. I took some time off but would like to now finally finalize setting up my lilypond jazz environment. I'm not a fan of the Chord font though, and I would like to reproduce the look in this demo.

My idea ist to set the chordname font to lilyjazz-text (instead of lilyjazz-chord) and then use lilyjazz-chord only for the special symbols (flat, sharp, triangle, etc.). One can easily switch fonts in markup with \override #'(font-name . "lilyjazz-chord){some text}, but I can't quite figure out how to make this work in the definition of JazzChordNames below.

I tried to replace the line (markup ">") with (markup \override #'(font-name . "lilyjazz-chord){">"} but that throws an error. Do you have any ideo on how to make this work?

My backup strategy is to create an entirely new font file where I would combine the letters from lilyjazz-text with the musical symbols in lilyjazz-chord

#(define (JazzChordNames pitch majmin)  ;majmin is a required argument for "chordNamer", but not used here
  (let* ((alt (ly:pitch-alteration pitch)))
    (make-line-markup
      (list
    (make-simple-markup
      (vector-ref #("C" "D" "E" "F" "G" "A" "B")
        (ly:pitch-notename pitch)))
    (if (= alt 0)           ; alteration ?
      (markup "")       ; do nothing
      (if (= alt FLAT)  ; flat or sharp
        (markup ">")
        (markup "<")
      )
    )
      )
    )
  )
)
...
% modify the default ChordNames context
\layout {
  \context {
    \ChordNames
    chordRootNamer = #JazzChordNames    % update the chord names
    chordNameExceptions = #JazzChords   % update the chord exceptions
    \override ChordName.font-name = #"lilyjazz-text"  % use the custom font for displaying the chords
  }
}
microtherion commented 5 years ago

I'll have to experiment a bit myself. The interaction between lilypond and scheme and the names used is a bit of a black art…

I'd also recommend testing your formatting at a number of different font sizes, to make sure it's scale independent.

baloe commented 5 years ago

I attempted the following after stumbling upon this. It compiles fine, but the #:override '(font-family . "lilyjazz-chord") has no impact either.

#(define (JazzChordNames pitch majmin)  ;majmin is a required argument for "chordNamer", but not used here
  (let* ((alt (ly:pitch-alteration pitch)))
    (make-line-markup
      (list
    (make-simple-markup
      (vector-ref #("C" "D" "E" "F" "G" "A" "B")
        (ly:pitch-notename pitch)))
    (if (= alt 0)           ; alteration ?
      (markup "")       ; do nothing
      (if (= alt FLAT)  ; flat or sharp
        (markup #:override '(font-family . "lilyjazz-chord") ">")
        (markup #:override '(font-family . "lilyjazz-chord") "<")
      )
    )
      )
    )
  )
)