> Le 16 janv. 2023 à 15:07, Mark Knoop <m...@opus11.net> a écrit :
> 
> 
> At 12:51 on 16 Jan 2023, Werner LEMBERG wrote:
>>> \new Staff {
>>>  \override TextScript.before-line-breaking =
>>>  #(lambda (grob)
>>>     (ly:grob-set-property! grob 'text
>>>                            (markup #:replace
>>>                                    `(("♭" . ,#{ \markup{ \tflat} #})
>>>                                      ("♯" . ,#{ \markup{ \tsharp} #})
>>>                                      ("♮" . ,#{ \markup{ \tnatural} #}))
>>>                                    (ly:grob-property grob 'text))))
>>>  c'1^"B♭"
>>>  c'1^"C♯"
>>>  c'1^"D♮"
>>> }
> 
>> *This* is nice!  It sort-of corresponds to 'active characters' in TeX.
>> Is there a possibility to register this or a similar function globally
>> so that all markup strings can use it?
> 
> How does this differ from the current mechanism using
> add-text-replacements! and replacement-alist?


It is the same mechanism, and add-text-replacements! answers Werner’s question.


> Could these be extended to
> allow the replacement string to include \markup?


Already done by me at some point in the 2.23 series (or the code above wouldn’t 
work).



Reply via email to