lilypond-user
[Top][All Lists]
Advanced

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

Re: Use custom font's flat (b) and sharp (#) symbols for chords (solved)


From: Matthias Hüsken
Subject: Re: Use custom font's flat (b) and sharp (#) symbols for chords (solved)
Date: Wed, 16 Feb 2011 18:23:34 +0100
User-agent: KMail/1.9.10

Hi again,

thanks a lot for the pointers in the right direction, I finally got my problem 
solved. It is based on the solution found here:
http://www.mailinglistarchive.com/address@hidden/msg02286.html

In case someone else stumbles upon this problem, here is my (shortened) 
solution:


% correct markup for "b" and "#" (use symbols from current font...)
chordFlat = \markup { \hspace #0.2 \fontsize #-1 \raise #0.1 "b" }
chordSharp = \markup { \hspace #0.1 \fontsize #-1 \lower #0.3 "#" }

% define custom chords
mhPopChordsMusic =
{
        <c e g bes>-\markup { \super "7" }
        % ... define all other possible chords here...
}

% Add to existing exceptions
mhPopChordsAdd = #(append
        (sequential-music-to-chord-exceptions mhPopChordsMusic #t)
        ignatzekExceptions)

% fix accidentals with some Scheme (using the current font's symbols)
#(define (mh-chord-name->pop-markup pitch)
  (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 it's natural, do nothing
      (if (= alt 0)
        (make-line-markup (list empty-markup))
        (if (= alt FLAT)
          ;; Otherwise, handle adding the flat symbol
          (make-line-markup
            (list
              (make-hspace-markup 0.3) ;; WAS: 0.4
              (make-small-markup (make-raise-markup 0.7
                (make-text-markup "b")))
            ))
          ;; or handle adding the sharp symbol
          (make-line-markup
            (list
              (make-hspace-markup 0.1) ;; WAS: 0.2
              (make-small-markup (make-raise-markup 0.7
                (make-text-markup "#")))
            ))
        )))))
)

% % use like this:
%
% {
%     popChords =
%     {
%         \set chordNameExceptions = #mhPopChordsAdd
%         \set chordRootNamer = #mh-chord-name->pop-markup
%     }
% }
% 
% % or like this:
%
% \layout
% {
%     \context
%     {
%         \Score
%         chordNameExceptions = #mhPopChordsAdd
%         chordRootNamer = #mh-chord-name->pop-markup
%     }
% }


Thanks again!

Matthias




reply via email to

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