lilypond-user
[Top][All Lists]
Advanced

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

Re: ChordName Font Size


From: Aaron Hill
Subject: Re: ChordName Font Size
Date: Mon, 13 May 2019 16:46:28 -0700
User-agent: Roundcube Webmail/1.3.8

On 2019-05-13 3:35 pm, Flaming Hakama by Elaine wrote:
I 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.

That is precisely the purpose of this function: To change the size of the letters in a chord name but not the musical symbols. (I admit I named it poorly, but the name of the function is largely unimportant compared to showing the technique.)

The issue OP had was that the font they used is undersized. This is a common problem in typography where fonts do not match their nominal sizes. If I use a font at a specified point size, that should strictly define how big glyphs appear to be; but apparently that common sense does not apply to type designers. Some fonts are simply too small for their supposed size.

The solution here is simple. An undersized font requires some "embiggening" but you do not want to affect the musical glyphs which are already at the correct size.

An alternate solution would be to change the procedure so that it only affects the musical glyphs. This would let you shrink the symbols to visually match the font once you have determine what size you want the lettering at. But why blame/punish the glyphs for being too big when it is the text that is too small?

In an effort to try to help understand how to adapt this function,
I started off by formatting and adding commentary to see if I
actually understand what it is doing.  There are numerous
questions therin.  If anyone can help explain how it works,
I might be able to move this forward.

                        ;;; 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)

Lists are pairs. Specifically, every (non-empty) list is a pair consisting of the first element and the rest of the elements, where the rest is itself a list or null. "car" is used here as the means to access the first item of a list. I could have said "first" which is an alias.


                            ;;; 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))

This is the inverse fontsize (note the negation) which is to counteract the global font size change applied outside the recursive function. Remember we are enlarging the entire chord name but need to shrink the glyphs by the opposite so the glyphs appear unchanged.

;;; 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)

This is the recursive element. We are only looking for \musicglyph and keeping the rest the same.

                        )

                        ;;; 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

This is anything that needs to be preserved because it is either an argument to a markup command or another markup command itself.

                       ;;; 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)))

"orig" is the original markup for the chord name as resulting from the default chord name function. I did not want to replace all of the existing logic, merely provide a wrapper. So I call the built-in function that will ultimately take care of returning a markup with the right chord names and symbols.

Then I apply an outer \fontsize to the whole thing which enlarges (or shrinks) the whole thing. But this affects everything and is no different to just setting the font size of the ChordName. The recursive helper was used to locate an apply a suitable inverse size operation so that any musical glyphs will remain unaffected. The result is only text should be changed.

Now if all this seems obtuse, I may remind you I did say this is a hack. I would not necessarily recommend this approach in general. The real answer is to use a font whose metrics are accurate so that things work properly without mucking about in markups.


-- Aaron Hill



reply via email to

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