Using arbitrary markup as lyric hyphen: Difference between revisions

m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Lyric hyphens have several user-modifiable properties such as length and thickness; this doesn’t allow, however, for further tweaking, for example, rendering hyphens as rounded boxes to better match the font possibly used for <code>LyricText</code>, or even printing hyphens as actual glyphs rather than drawing basic boxes.
Lyric hyphens have several user-modifiable properties such as length and thickness; this doesn’t allow, however, for further tweaking, for example, rendering hyphens as rounded boxes to better match the font possibly used for <code>LyricText</code>, or even printing hyphens as actual glyphs rather than drawing basic boxes.


This snippet rewrites the <code>LyricHyphen</code> stencil procedure to use a proper glyph… or indeed any arbitrary markup.
This snippet rewrites the <code>LyricHyphen</code> stencil procedure to use a proper glyph – or indeed any arbitrary markup.


<lilypond version="2.24" full>
<lilypond version="2.24">
%% Originally contributed by Aaron Hill:
% Originally contributed by Aaron Hill:
%% https://lists.gnu.org/archive/html/lilypond-user/2019-03/msg00257.html
% https://lists.gnu.org/archive/html/lilypond-user/2019-03/msg00257.html


#(define (lyric-hyphen-text-stencil grob)
#(define (lyric-hyphen-text-stencil grob)
Line 95: Line 95:
   Lo -- rem ip -- sum do -- lor sit a -- met.
   Lo -- rem ip -- sum do -- lor sit a -- met.
    
    
   \mark \markup { "LyricHyphen.text is " \circle \with-color #red "&" }
   \mark \markup { "LyricHyphen.text is " \circle \with-color #red "" }
   \override LyricHyphen.text =  
   \override LyricHyphen.text = \markup \circle \with-color #red "♥"
    \markup
      \circle \with-color #red  
      %% For unknown reason "\xe2\x99\xa5", which is "♥", U+2665, does not work in LSR,
      %% replacing it with "&"
      %% Outside of LSR it works -- Harm
      %%
      %% Outside LSR it's possible to use "♥" directly for guile-v1 and guile-v2  --Harm (May 2022)
      #"&"
   \override LyricText.font-size = #3
   \override LyricText.font-size = #3
   Lo -- rem ip -- sum do -- lor sit a -- met.
   Lo -- rem ip -- sum do -- lor sit a -- met.


      %% Same here for "\xe2\x89\x8b", which is "≋", U+224B, does not work in LSR,
   \mark \markup { "LyricHyphen.text is blue" \with-color #blue #"" }
      %% replacing it with "~"
      %% Outside of LSR it works -- Harm
      %%
      %% Outside LSR it's possible to use "≋" directly for guile-v1 and guile-v2  --Harm (May 2022)
 
   \mark \markup { "LyricHyphen.text is blue" \with-color #blue #"~" }
   \override LyricHyphen.text =  
   \override LyricHyphen.text =  
     \markup
     \markup \scale #'(3 . 1) \with-color #blue #""
      \scale #'(3 . 1) \with-color #blue #"~"
   \override LyricText.font-size = #6
   \override LyricText.font-size = #6
   Break -- ing
   Break -- ing
Line 123: Line 108:
</lilypond>
</lilypond>


[[Category:Scheme]]
[[Category:Tweaks and overrides]]
[[Category:Vocal music]]
[[Category:Vocal music]]
[[Category:Tweaks and overrides]]
[[Category:Snippet]]