Re: Magnetic snap and whiteout on LyricText: warnings

2023-06-05 Thread Jean Abou Samra
Le lundi 05 juin 2023 à 22:24 +0200, Jean Abou Samra a écrit :
> Le lundi 05 juin 2023 à 22:22 +0200, Jean Abou Samra a écrit :
> > Le lundi 05 juin 2023 à 21:23 +0200, Simon Albrecht a écrit :
> > > Hello everyone,
> > > 
> > > I don’t know where the “Lyric syllable magnetic snap” snippet is mainly 
> > > stored
> > 
> > 
> > 
> > https://lsr.di.unimi.it/LSR/Item?id=1154
> 
> 
> D'oh! Never mind. I confused the snippet that respaces lyrics with the one 
> that squashes close words. Sorry.
> 


Well, for my defense, I did also post a revised version of the “magnetic 
lyrics” snippet:

https://www.mail-archive.com/lilypond-user@gnu.org/msg149201.html

(though I didn't put that one on LSR)


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


Re: Magnetic snap and whiteout on LyricText: warnings

2023-06-05 Thread Jean Abou Samra
Le lundi 05 juin 2023 à 21:23 +0200, Simon Albrecht a écrit :
> Hello everyone,
> 
> I don’t know where the “Lyric syllable magnetic snap” snippet is mainly stored



https://lsr.di.unimi.it/LSR/Item?id=1154


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


Re: Magnetic snap and whiteout on LyricText: warnings

2023-06-05 Thread Jean Abou Samra
Le lundi 05 juin 2023 à 22:22 +0200, Jean Abou Samra a écrit :
> Le lundi 05 juin 2023 à 21:23 +0200, Simon Albrecht a écrit :
> > Hello everyone,
> > 
> > I don’t know where the “Lyric syllable magnetic snap” snippet is mainly 
> > stored
> 
> 
> 
> https://lsr.di.unimi.it/LSR/Item?id=1154


D'oh! Never mind. I confused the snippet that respaces lyrics with the one that 
squashes close words. Sorry.



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


Magnetic snap and whiteout on LyricText: warnings

2023-06-05 Thread Simon Albrecht

Hello everyone,

I don’t know where the “Lyric syllable magnetic snap” snippet is mainly 
stored, I grabbed it from the list years ago and attach it in the 
version that I have, from December 2011 and with links to user list 
archive. I hope I’m not somehow behind time with this, having followed 
the user list only sporadically in the years since.


I have tracked down why I always got warnings about “infinity or nan” in 
every vocal music score I engraved: with the snippet, the last syllable 
of a LyricWord gets a #ly:text-interface::print stencil with 
#empty-markup as text, which results in multiple warnings each time Lily 
tries to apply whiteout to such a syllable. (tiny example below)


This is fixed by, in line 187 of the attached file, replacing 
ly:text-interface::print with point-stencil (an infinitely small 
stencil, IIUC). To avoid misunderstandings: the attached version does 
NOT have the fix applied.


I’m not aware of this snippet being available anywhere except the list 
archives. Surely it would be a good candidate for the LSR and OLL, 
wouldn’t it?


Best, Simon


\version "2.25.5"

\include "lyr-syl-magn-snap.ily"

\layout {
  \context {
    \Lyrics
    \override LyricText.whiteout = 1
  }
}

<<
  { 2 2 }
  \addlyrics { aaa -- b }
>>
%%%\version "2.23.5"

\include "lyr-syl-magn-snap.ily"

<<
  \new Voice = "foo" \relative c' {
\repeat unfold 16 { a8 b a2 a8 b }
  }
  \new Lyrics \lyricsto "foo" {
\override Lyrics.LyricWord.after-line-breaking = #(lyric-word-compressor 0)
\override Lyrics.LyricHyphen.minimum-distance = #0
\override Lyrics.LyricSpace.minimum-distance = #1
\repeat unfold 10 { foo }
\repeat unfold 10 { foo -- \markup \caps bar }
\repeat unfold 10 { \markup \bold syl -- la -- ble }
a \markup \with-color #red ran -- \markup \box dom string of mo -- no -- syl -- la -- bic
and mul -- ti -- \markup \fontsize #5 syl -- la -- bic
\markup \bold \underline ver -- \markup \italic bi -- age
\markup {
  \stencil #(make-circle-stencil 0.5 0 #f)
}
  }
>>

<<
  \new Voice = "foo" \relative c' {
\repeat unfold 16 { a8 b a2 a8 b }
  }
  \new Lyrics \lyricsto "foo" {
\override Lyrics.LyricWord.after-line-breaking = #(lyric-word-compressor 0.4)
\override Lyrics.LyricHyphen.minimum-distance = #0
\override Lyrics.LyricSpace.minimum-distance = #1
\repeat unfold 10 { foo }
\repeat unfold 10 { foo -- \markup \caps bar }
\repeat unfold 10 { \markup \bold syl -- la -- ble }
a ran -- \markup \box dom string of
\wordunderline mo -- no -- syl -- \markup \underline la -- bic
and \wordbox mul -- ti -- \markup \fontsize #5 syl -- la -- \markup \box bic
\wordunderline ver -- \markup \italic bi -- age
\markup {
  \stencil #(make-circle-stencil 0.5 0 #f)
}
  }
>>

\layout {
  ragged-last = ##t
}

Re: Get the margin values

2023-06-05 Thread Pierre Perol-Schneider
Simon, Jean, thank you both !

Le lun. 5 juin 2023 à 15:45, Jean Abou Samra  a écrit :

> Le lundi 05 juin 2023 à 15:34 +0200, Simon Albrecht a écrit :
>
> However, I can’t say why the right margin isn’t yet known by the time it
> is queried.
>
>
>
>
> Well, don't use “$defaultpaper”, that's the toplevel \paper block, which
> is almost always not what you want. If your markup command is used on score
> level like with { c'^\markup \margin ... }, it should be affected \paper
> settings on \score level. Use “layout” instead (or another name like
> “output-def” if you have defined your markup command as “(margin output-def
> props ...) (...)”, though the name “layout” is conventional).
>
> I seem to recall “$defaultpaper” is not normalized which could be why
> you're seeing undefined margins, but I didn't check. “layout” is definitely
> what you want in this case.
>
> Jean
>
>


Re: Get the margin values

2023-06-05 Thread Jean Abou Samra
Le lundi 05 juin 2023 à 15:34 +0200, Simon Albrecht a écrit :
> However, I can’t say why the right margin isn’t yet known by the time it 
> is queried.



Well, don't use “$defaultpaper”, that's the toplevel \paper block, which is 
almost always not what you want. If your markup command is used on score level 
like with { c'^\markup \margin ... }, it
should be affected \paper settings on \score level. Use “layout” instead (or 
another name like “output-def” if you have defined your markup command as 
“(margin output-def props ...) (...)”, though the
name “layout” is conventional).

I seem to recall “$defaultpaper” is not normalized which could be why you're 
seeing undefined margins, but I didn't check. “layout” is definitely what you 
want in this case.

Jean



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


Re: Get the margin values

2023-06-05 Thread Simon Albrecht

Hi Pierre,

On 05.06.23 15:07, Pierre Perol-Schneider wrote:

So how can I get the paper values as a markp?


the call to ly:output-def-lookup returns a number or an empty list. So 
this returns valid markup regardless:



\version "2.24.1"

\paper {
  top-margin = 30
  %bottom-margin = 30
  left-margin = 30
  %right-margin = 30
}

#(define-markup-command
  (margin layout props)()
  (let* ((prnt (lambda (i) (let ((mrgn (ly:output-def-lookup 
$defaultpaper i)))

 (if (number? mrgn)
 (number->string mrgn)
 "not yet known"
 (top-margin (prnt 'top-margin))
 (bottom-margin (prnt 'bottom-margin))
 (left-margin (prnt 'left-margin))
 (right-margin  (prnt 'right-margin)))
    (interpret-markup layout props
  #{
    \markup\column {
  \line { top-margin = #top-margin }
  \line { bottom-margin = #bottom-margin }
  \line { left-margin = #left-margin }
  \line { right-margin = #right-margin }
    }
  #})))

% Test:
\markup\margin

%

However, I can’t say why the right margin isn’t yet known by the time it 
is queried.


Best, Simon



Re: Get the margin values

2023-06-05 Thread Pierre Perol-Schneider
So far:

\version "2.24.1"

\paper {
  top-margin = 30
  left-margin = 30
}

#(define-markup-command
  (margin layout props)()
  (let* ((top-margin   (ly:output-def-lookup $defaultpaper 'top-margin))
 (bottom-margin  (ly:output-def-lookup $defaultpaper
'bottom-margin))
 (left-margin  (ly:output-def-lookup $defaultpaper 'left-margin))
 (right-margin   (ly:output-def-lookup $defaultpaper
'right-margin)))
(interpret-markup layout props
  #{
\markup\column {
  \line { top-margin = #top-margin }
  \line { bottom-margin = #bottom-margin }
  \line { left-margin = #left-margin }
  \line { right-margin = #right-margin }
}
  #})))

% Test:
\markup\margin

Error: not a markup
So how can I get the paper values as a markp?
Tia, cheers,
Pierre

Le lun. 5 juin 2023 à 09:54, Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com> a écrit :

> Dear List,
> How could I automagically get the margin values, including the default
> values ?
>
> Ex.
>
> \version "2.24.1"
>
> \paper {
>   top-margin = 30
>   left-margin = 30
> }
>
> \markuplist {
>   "top-margin = ?"
>   "bottom-margin = ?"
>   "left-margin = ?"
>   "right-margin = ?"
> }
>
> TIA, cheers,
> Pierre
>


Get the margin values

2023-06-05 Thread Pierre Perol-Schneider
Dear List,
How could I automagically get the margin values, including the default
values ?

Ex.

\version "2.24.1"

\paper {
  top-margin = 30
  left-margin = 30
}

\markuplist {
  "top-margin = ?"
  "bottom-margin = ?"
  "left-margin = ?"
  "right-margin = ?"
}

TIA, cheers,
Pierre