lilypond-user
[Top][All Lists]
Advanced

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

Re: Changes to Notename - lost some functionality


From: Jean Abou Samra
Subject: Re: Changes to Notename - lost some functionality
Date: Wed, 13 Dec 2023 21:29:03 +0100
User-agent: Evolution 3.50.2 (3.50.2-1.fc39)

This code is too big for me to digest it, but the basic problem is that 

   (let* ((default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames)))

is doing a lookup in your newnames alist with the value of text as the key. In more recent versions, text is not a string but a full markup, which you can see if you add (display default-name). So the lookup fails, assoc-get returns false (#f), and you set the grob's text to false, which leads to a warning because false isn't a markup.

The quick fix here is to change

(let* ((default-name (ly:grob-property grob 'text)))

to

(let* ((default-name (markup->string (ly:grob-property grob 'text))))

in order to first get an approximate string representation of that markup that corresponds to the keys in your alist.

But instead of this fragile method of changing note names, it would be a lot better to write a custom noteNameFunction, e.g.,

\version "2.24.2"

\new NoteNames {
  \set noteNameFunction =
    #(lambda (pitch context)
       ;; Write logic to compute the note name from `pitch` as a markup.
       "TODO")
  c' d' e'
}

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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