|
From: | Gregory Hollands |
Subject: | Re: ChordName Font Size |
Date: | Mon, 13 May 2019 20:18:33 -0400 |
> I want to use an alternative font for ChordNames, but the font I have
> chosen is not exactly the same size as the default font. The result is
> that
> musical symbols (sharps, flat, etc) appear too large.
>
> How can I change the size of the musical symbols in ChordNames so that
> they
> match the size of the font?
Here is a bit of a hack:
%%%%
\version "2.19.82"
embiggenChordNames = #(define-scheme-function (size) (number?)
#{ \with {
chordNameFunction = #(lambda (in-pitches bass inversion context)
(define (helper mu)
(if (list? mu)
(if (eq? (car mu) musicglyph-markup)
(markup (#:fontsize (- size) mu))
(map helper mu))
mu))
(let ((orig (ignatzek-chord-names in-pitches bass inversion
context)))
(markup (#:fontsize size (helper orig)))))
} #} )
theChords = \chordmode { c2:7 g2:dim aes2:m fis2 }
<< \new ChordNames \theChords
\new ChordNames \with \embiggenChordNames #5 \theChords
\new ChordNames \with \embiggenChordNames #-3 \theChords >>
%%%%
This applies a global \fontsize to the markup to scale everything up by
a specified amount; however, it also looks within the markup for
occurrences of \musicglyph and applies an inverse \fontsize so they
remain the original size.
Wouldn't be surprised to learn there is some built-in procedure like
map-some-music but for markup that would obsolete my helper function
above. But I threw this together pretty quickly.
---------- Forwarded message ----------
From: Aaron Hill <address@hidden>
To: address@hidden
Date: Sun, 12 May 2019 21:13:54 -0700
Subject: Re: ChordName Font Size
On 2019-05-12 5:29 pm, Gregory Hollands wrote:
> I want to use an alternative font for ChordNames, but the font I have
> chosen is not exactly the same size as the default font. The result is
> that
> musical symbols (sharps, flat, etc) appear too large.
>
> How can I change the size of the musical symbols in ChordNames so that
> they
> match the size of the font?
Here is a bit of a hack:
%%%%
\version "2.19.82"
embiggenChordNames = #(define-scheme-function (size) (number?)
#{ \with {
chordNameFunction = #(lambda (in-pitches bass inversion context)
(define (helper mu)
(if (list? mu)
(if (eq? (car mu) musicglyph-markup)
(markup (#:fontsize (- size) mu))
(map helper mu))
mu))
(let ((orig (ignatzek-chord-names in-pitches bass inversion
context)))
(markup (#:fontsize size (helper orig)))))
} #} )
theChords = \chordmode { c2:7 g2:dim aes2:m fis2 }
<< \new ChordNames \theChords
\new ChordNames \with \embiggenChordNames #5 \theChords
\new ChordNames \with \embiggenChordNames #-3 \theChords >>
%%%%
This applies a global \fontsize to the markup to scale everything up by
a specified amount; however, it also looks within the markup for
occurrences of \musicglyph and applies an inverse \fontsize so they
remain the original size.
Wouldn't be surprised to learn there is some built-in procedure like
map-some-music but for markup that would obsolete my helper function
above. But I threw this together pretty quickly.
-- Aaron Hill_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-userI was going to reply to this, then realized I hadn't read the question specifically enough.When I tried this approach suggested by Aaron,I noticed that it doesn't actually address the question,as it leaves the musical symbols (like sharp, flat) the same size,while the text font changes size.I started to try to modify this so that it would apply a different scaling to themusical symbols, but couldn't figure out how to do that.In an effort to try to help understand how to adapt this function,
I started off by formatting and adding commentary to see if Iactually understand what it is doing. There are numerousquestions therin. If anyone can help explain how it works,I might be able to move this forward.%%%
\version "2.19"
% The original
embiggenChordNames = #(define-scheme-function (size) (number?)
#{ \with {
chordNameFunction = #(lambda (in-pitches bass inversion context)
(define (helper mu)
(if (list? mu)
(if (eq? (car mu) musicglyph-markup)
(markup (#:fontsize (- size) mu))
(map helper mu))
mu))
(let ((orig (ignatzek-chord-names in-pitches bass inversion
context)))
(markup (#:fontsize size (helper orig)))))
} #} )
% My attempt at explanation
embiggenChordNames = #(define-scheme-function
(size)
(number?)
#{
\with {
chordNameFunction = #(lambda
(in-pitches bass inversion context)
;;; A recursive function that goes through the elements in the list
(define (helper mu)
;;; See if the element is a list
(if (list? mu)
;;; The case where mu is a list.
;;; This next statement confuses me
;;; since in it, we treat mu as a pair, by using car.
;;; So, it it a list or a pair?
(if (eq? (car mu) musicglyph-markup)
;;; The case where the first element of the pair is a musical symbol?
;;; So adjust its font size.
;;; However, in practice this appears to affect the text,
;;; rather than the symbols.
(markup (#:fontsize (- size) mu))
;;; The case where the first element not is a musical symbol?
;;; Seems like we are assuming it is not an element that needs adjustment
;;; but rather another list on which we recurse.
;;; I would have guessed (based on the logic) that this might be the case for text.
;;; or (based on the output) that this might be the case for musical symbols.
(map helper mu)
)
;;; The base case, where we do not have a list.
;;; Why are we not concerned with the font size of this element?
;;; What type of element do we expect this to be?
mu
)
)
;;; Apply the function defined above to a copy of the chord info
(let
(
;;; What does this represent?
;;; Seems like it must be referencing something from which this
;;; function is applied--the thing to which this is \with-ed?
(orig (ignatzek-chord-names in-pitches bass inversion context) )
)
(markup (#:fontsize size (helper orig)))
)
)
}
#}
)
theChords = \chordmode { c2:7 g2:dim aes2:m fis2 }
<<
\new ChordNames \theChords
% Demonstrating what seems to be close to the default: 0.5
\new ChordNames \with \embiggenChordNames #0.5 \theChords
\new ChordNames \with \embiggenChordNames #6 \theChords
\new ChordNames \with \embiggenChordNames #-3 \theChords
>>
%%%%Thanks,Elaine Alt415 . 341 .4954 "Confusion is highly underrated"address@hiddenProducer ~ Composer ~ Instrumentalist ~ Educator-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[Prev in Thread] | Current Thread | [Next in Thread] |