Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG


>> the snippet below demonstrates that top-staff lyrics are
>> incorrectly positioned above rehearsal marks if the engraver for
>> the latter is moved to another context (I need that in a full score
>> with rehearsal marks printed simultaneously at three different
>> vertical positions).
> 
> That looks as expected to me.  The Mark_engraver is on Staff level
> and the Lyrics context goes above your Staff context, so the lyrics
> get higher than the marks.  Why would it look different?

OK, I simplified my real-world example too much, since...

> I think you likely want to move the Mark_engraver to a kind
> of MarkLine context instead.

... I'm doing exactly that and was actually bitten by...

> I was going to recommend moving it to StaffGroup, but I found
> https://gitlab.com/lilypond/lilypond/-/issues/6357

this bug :-)


Werner



Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG

> I think you likely want to move the Mark_engraver to a kind of
> MarkLine context instead.

Well, the problem is that such a context needs the
`Axis_group_engraver`, which tries to align stuff horizontally on a
line.  I don't want that.  Rehearsal and tempo marks should be aligned
on the selected staff as if they were part of it, see attached
example.  But maybe you and your wizardry find a solution for that :-)


Werner
\version "2.23.10"

music = { a'1 ~ | a' | a' | a' }
text = \lyricmode {
  foo __

}
top = { \tempo "Allegro" s1 | s | \mark\default s | s }


\score {
  <<
\new Staff = "staff" <<
  \top
  \new NullVoice = "aligner" \music
  \music
>>
\new Lyrics \with {
  alignAboveContext = "staff"
}
  \lyricsto "aligner" \text
  >>
}

\score {
  <<
\new MarkLine \top

\new Staff = "staff" <<
  \music
  \new NullVoice = "aligner" \music
>>
\new Lyrics \with {
  alignAboveContext = "staff"
}
  \lyricsto "aligner" \text
  >>
  \layout {
\context {
  \Score
  \remove Mark_engraver
  \remove Staff_collecting_engraver
  \accepts MarkLine
}
\context {
  \name MarkLine
  \type Engraver_group
  \consists Axis_group_engraver
  \consists Mark_engraver
  \override VerticalAxisGroup.staff-affinity = #DOWN
  \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = #0.5
  \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #0.5
}
  }
}


rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG

Dear LilyPonders,


the snippet below demonstrates that top-staff lyrics are incorrectly
positioned above rehearsal marks if the engraver for the latter is
moved to another context (I need that in a full score with rehearsal
marks printed simultaneously at three different vertical positions).

What am I missing?


Werner
music = { a'1 ~ | a' } 
text = \lyricmode { foo __ }
top = { s1 | \mark\default s1 }

\score {
  \new Staff = "staff"
  <<
\top
\music

\new NullVoice = "aligner" \music
\new Lyrics \with { alignAboveContext = "staff" }
  \lyricsto "aligner" \text
  >>
}


\score {
  \new Staff = "staff" \with { \consists Mark_engraver }
  <<
\top
\music

\new NullVoice = "aligner" \music
\new Lyrics \with { alignAboveContext = "staff" }
  \lyricsto "aligner" \text
  >>

  \layout {
\context {
  \Score
  \remove Mark_engraver
}
  }
}


Re: vertical half-brackets

2022-06-01 Thread Werner LEMBERG


>> * Has someone coded this already?  I couldn't find code in the LSR.
> 
> I don't know if this is still the most ideal way, but it works.
> [...]

Thanks a lot for all the replies!  I'll analyze them and cook
something up for my needs.


Werner



Re: vertical half-brackets

2022-05-31 Thread Werner LEMBERG


>> For piano music it is common to indicate the use of the right hand in
>> the lower staff with a 'half-bracket' [...]
>
> In the NR I find
> 
> Indicating cross-staff chords with arpeggio bracket [...]
>
> It's not a half-bracket but it's the closest in the manual I can
> find at a glance.

Thanks.  I was aware of this, but for the given case it can't be used.


Werner



Re: vertical half-brackets

2022-05-31 Thread Werner LEMBERG


> * What's the right term for this 'half-bracket'?

BTW, in SMuFL this symbol is called 'keyboardPlayWithRH' :-)

  https://w3c.github.io/smufl/latest/tables/keyboard-techniques.html


Werner



vertical half-brackets

2022-05-31 Thread Werner LEMBERG

For piano music it is common to indicate the use of the right hand in
the lower staff with a 'half-bracket' (and vice versa for the upper
staff), see image.

Two questions.

* What's the right term for this 'half-bracket'?

* Has someone coded this already?  I couldn't find code in the LSR.

Thanks in advance for guidance!


Werner


Re: Piano pedalling in (conductor) scores

2022-05-31 Thread Werner LEMBERG


> Well, just look at a Mahler score.  He was one of the great
> conductors, and the strings are full of bowing marks.  How many of
> them are followed by conductors these days I don't know.

Well, just look at a Richard Strauss score :-)  His scores are full of
legatos in the strings which are definitely *not* meant to be executed
as bowing instructions.

Note also that until the beginning of the 20th century the players in
a string group of an orchestra did not try at all to have the same
bowing.  In scores of that time, notated bowing marks are intended as
a special sound effect (for example, a sequence of down-bow-only
notes).


Werner



Re: make \breath (kind-of) ignore clef change

2022-05-26 Thread Werner LEMBERG
>>> Please have a look at the attached image.  What must I do to make
>>> the breathe sign 'ignore' the change clef so that the breathe sign
>>> is positioned as if the change clef wasn't there?  [...]
> 
> There's always this sort of trick: [...]

Excellent, thank you!

> Is this canonical presentation though?  I find it visually
> surprising.

For a full score with spacing constraints it is perfect, see attached
image.


Werner


Re: make \breath (kind-of) ignore clef change

2022-05-26 Thread Werner LEMBERG

> [git f326290b65351]
> 
> Please have a look at the attached image.  What must I do to make
> the breathe sign 'ignore' the change clef so that the breathe sign
> is positioned as if the change clef wasn't there?

Well, having some code certainly helps :-)

```
{ 1 \breathe |  }

{ 1 \breathe \clef alto |  }
```


Werner


make \breath (kind-of) ignore clef change

2022-05-26 Thread Werner LEMBERG

[git f326290b65351]

Please have a look at the attached image.  What must I do to make the
breathe sign 'ignore' the change clef so that the breathe sign is
positioned as if the change clef wasn't there?


Werner


Re: printing "a 2" at the beginning of staves automatically

2022-05-23 Thread Werner LEMBERG

>> * Contrary to Valentin's solution, the first 'a 2' text is not
>>   left-aligned to the left edge of the note head.  This is
>>   especially visible with whole notes (see attached image).  [...]
>
> See the attached file, fixing that problem and making it per-voice.

Thanks, will test soon in more detail.

>> * `\tweak` doesn't work right before `\set Staff.staffAnnotation`.
>>Instead, I have to use `\once \override`, AFAICS.
>
> It actually never makes sense to \tweak a \set.  [...]

Thanks for the explanation.

>>Hopefully, I'm missing something.  Otherwise both Valentin's and
>>Jeans' solutions are heavily limited because it happens quite
>>often that the 'a 2' string must be positioned individually
>>without affecting other rehearsal marks – or text spanners.
>
> What do you mean by 'positioned individually'?  Can you give an
> example?

[Referring to your latest code version]

Let's assume that I could adjust `bound-details` of the `TextSpanner`
grob created by `\annotation` (which is not possible).  If an ordinary
text spanner starts at the same time, overrides like

```
\once \override TextSpanner.bound-details.left.padding = -2
\annotation "2."
c'1\startTextSpan
```

would affect both spanners because they start at the same moment.
BTW, it would be very helpful if `padding` actually moved the 'a 2'
text horizontally...

> This question also still stands:
>
>
>>> Very nice, thanks!  Besides the (hopefully) harmless warning
>>>
>>> ```
>>> programming error: Spanner `TextSpanner' is not fully contained
>>>    in parent spanner.  Ignoring orphaned part
>>> continuing, cross fingers
>>> ```
>>>
>>> it seems to work fine.
>>>
>>>
>>>  Werner
>>
>>
>> Can you give an example where it occurs?

I haven't found the time yet to reduce the code of my real-world
example to do that.


Werner


Re: `StaffGroup` prevents articulation shifted under time signature

2022-05-23 Thread Werner LEMBERG


> dynamicLengthOff = {
>   \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
>   \override DynamicText.extra-spacing-height = #'(0 . 0)
> }

Nice idea, thanks!


Werner



Re: `StaffGroup` prevents articulation shifted under time signature

2022-05-23 Thread Werner LEMBERG
>> The following example
>>
>> ```
>> <<
>>\new Staff { f'1 }
>>\new Staff { f'1 \tweak X-offset #-5 \pp }
>> \new StaffGroup <<
>>\new Staff { f'1 }
>>\new Staff { f'1 \tweak X-offset #-5 \pp }
>> ```
>>
>> shows that I can't move the 'pp' to sit under the time signature if
>> I use `StaffGroup`.  How can I change this?  Within full scores it
>> is of great importance to retain this ability.
>
> The definition of StaffGroup in engraver-init.ly contains
>
>   %% The default for DynamicText.extra-spacing-width causes dynamics
>   %% to be placed across span bars, so switch it off:
>   \override DynamicText.extra-spacing-width = ##f

D'oh, I should have looked into this file.  Thanks!

This override causes too much collateral damage; I've thus just filed

  https://gitlab.com/lilypond/lilypond/-/issues/6350


Werner



`StaffGroup` prevents articulation shifted under time signature

2022-05-23 Thread Werner LEMBERG

[LilyPond version 2.23.9]

The following example

```
<<
  \new Staff { f'1 }
  \new Staff { f'1 \tweak X-offset #-5 \pp }
>>

\new StaffGroup <<
  \new Staff { f'1 }
  \new Staff { f'1 \tweak X-offset #-5 \pp }
>>
```

shows that I can't move the 'pp' to sit under the time signature if I
use `StaffGroup`.  How can I change this?  Within full scores it is of
great importance to retain this ability.


Werner


Re: printing "a 2" at the beginning of staves automatically

2022-05-23 Thread Werner LEMBERG

>>> Meanwhile, how about using a spanner rather than an item?  See
>>> attached.
> 
> Aaand some nits :-)

I forget another one.

* If you look at the attached image (from 'Carmina burana') it
  probably makes sense to have the staff annotation engraver actually
  live in the Voice context.  We should thus have a different name, I
  guess.


 Werner


Re: printing "a 2" at the beginning of staves automatically

2022-05-23 Thread Werner LEMBERG

>> Meanwhile, how about using a spanner rather than an item?  See
>> attached.

Aaand some nits :-)

* Contrary to Valentin's solution, the first 'a 2' text is not
  left-aligned to the left edge of the note head.  This is especially
  visible with whole notes (see attached image).  It is not clear to
  me why this is so, given that text is left-aligned if I do

  ```
  \override TextSpanner.bound-details.left.text = "rit."
  c’1\startTextSpan
  ```

  for example.

* `\tweak` doesn't work right before `\set Staff.staffAnnotation`.
  Instead, I have to use `\once \override`, AFAICS.

  Hopefully, I'm missing something.  Otherwise both Valentin's and
  Jeans' solutions are heavily limited because it happens quite often
  that the 'a 2' string must be positioned individually without
  affecting other rehearsal marks – or text spanners.


Werner


Re: printing "a 2" at the beginning of staves automatically,Re: printing "a 2" at the beginning of staves automatically

2022-05-23 Thread Werner LEMBERG

> I’ve changed it up so that the a2 is always aligned to the note when
> it is set.  This also solves the first one not being printed.

Thanks!


Werner


Re: printing "a 2" at the beginning of staves automatically

2022-05-23 Thread Werner LEMBERG


> Meanwhile, how about using a spanner rather than an item? See
> attached.

Very nice, thanks!  Besides the (hopefully) harmless warning

```
programming error: Spanner `TextSpanner' is not fully contained
   in parent spanner.  Ignoring orphaned part
continuing, cross fingers
```

it seems to work fine.


Werner



Re: printing "a 2" at the beginning of staves automatically

2022-05-22 Thread Werner LEMBERG

> Basically, it works great, but there are two problems (tested with
> 2.23.9).
> 
> * It doesn't print 'a 2' at the very beginning.
> 
> * Contrary to `\mark`, the 'a 2' should always be horizontally
>   aligned to a note column and not to prefatory matter like time or
>   key signatures.

And I've just found a third, serious problem:

* Broken ties disappear.  The attached image shows the previous
  example with an inserted tie, with and without all annotations
  removed.


Werner


Re: printing "a 2" at the beginning of staves automatically

2022-05-21 Thread Werner LEMBERG


> The optimal solution (IMO) would be to improve the whole instrument
> definition, switching, and [staff-]labelling framework such that
> \addInstrumentDefinition and \instrumentSwitch would change the
> appropriate texts so that the engraver(s) could present the
> information automagically according to some parameter-driven
> algorithm.  I hope one day we can make that happen.

AFAICS, there isn't an issue in the LilyPond tracker that documents
the needs, a possible algorithm, and the necessary parameters.  I
think it would be a good start if you could submit this information.


Werner



Re: printing "a 2" at the beginning of staves automatically

2022-05-21 Thread Werner LEMBERG

>> while it is probably not the best way to do it, here is a
>> pragmatical solution to the problem.
> 
> Thanks a lot!  Will try it soon.

Basically, it works great, but there are two problems (tested with
2.23.9).

* It doesn't print 'a 2' at the very beginning.

* Contrary to `\mark`, the 'a 2' should always be horizontally aligned
  to a note column and not to prefatory matter like time or key
  signatures.

The attached image shows the output of

```
{
  \set Staff.staffAnnotation = "a 2" c'1 1 \break 1 1 1 \break 1 1
  \key c\minor \time 2/2 
  \set Staff.staffAnnotation = "a 3" 1 \break 1 
  \set Staff.staffAnnotation = "a 4" \break 1 2
  \set Staff.staffAnnotation = "a 42" 2 1 
  \unset Staff.staffAnnotation \break 1
}
```

Not sure whether this can be easily fixed without setting up a new
grob that doesn't interfere with `RehearsalMark` – sometimes it is
necessary to horizontally shift 'a 2' without influencing the
positioning of rehearsal marks at exactly the same spot.


Werner


Re: printing "a 2" at the beginning of staves automatically,Re: printing "a 2" at the beginning of staves automatically

2022-05-21 Thread Werner LEMBERG


> while it is probably not the best way to do it, here is a
> pragmatical solution to the problem.

Thanks a lot!  Will try it soon.


Werner



Re: LilyPond 2.23.9 released

2022-05-21 Thread Werner LEMBERG

>> Note that the MacPorts port of LilyPond 2.22.2 already uses Guile
>> 2.2 bytecode and provides a binary for Apple Silicon, too.
>> 
>>   https://ports.macports.org/port/lilypond/details/
> 
> No, the 2.22.2 version uses Guile 1.8 as can be easily seen from the
> dependencies.  Even if it used Guile 2.2 as Homebrew does, it cannot
> use Guile bytecode because that is fundamentally not possible with
> stable/2.22.  Please don't spread wrong information.

Oops, you are right, sorry.  I was confused.


Werner


Re: LilyPond 2.23.9 released

2022-05-21 Thread Werner LEMBERG


>>  Currently homebrew provides Lilypond 2.22.2 for Apple Silicon,
>> that is what I am using.
> 
> Did you try running the x86_64 binaries via Apple's Rosetta tool? That
> might be a bit slower than native executables, but given that Homebrew
> builds 2.22.2 without Guile bytecode, it might actually be comparable.

Note that the MacPorts port of LilyPond 2.22.2 already uses Guile 2.2
bytecode and provides a binary for Apple Silicon, too.

  https://ports.macports.org/port/lilypond/details/


Werner



printing "a 2" at the beginning of staves automatically

2022-05-21 Thread Werner LEMBERG


Let's assume that I have 40 bars of flute 1 and 2 in a single staff of
a full score.  At the very beginning of these bars I write "a 2", and
I want this remark repeated at the beginning of every staff where this
is still true.  [Obviously I'm not using `\partCombine` :-)]

Has anyone already set up such a thing?  I looked into the LSR but
could find something related.  It seems to me that a text spanner
could do it, but it shouldn't interact with any other (text) spanners.


Werner



Re: within \markup, how to \translate by width of another markup?

2022-05-17 Thread Werner LEMBERG
>> AFAICS, we are back to square one, needing the possibility to
>> `\translate` something by the width of another markup.  I will cook
>> something up and see how well it works.
>
>
> Probably
>
> ```
> \version "2.22.2"
>
> #(define-markup-command (translate-by-extent-of layout props axis direction 
> extent-source mkup)
>    (index? ly:dir? markup? markup?)
>    (let* ((stil (interpret-markup layout props mkup))
>   (source-stil (interpret-markup layout props extent-source))
>   (ext (ly:stencil-extent source-stil axis))
>   (trans (* direction (interval-length ext
>    (ly:stencil-translate-axis stil trans axis)))
>
>
> \markup \box \number \column {
>   \translate-by-extent-of #X #RIGHT 9 \right-align { 11 10 }
>   6 5 4 3 2 1
> }
> ```
>
>
> That being said, I think I would rather define an interface to
> align a markup on another markup.
>
> ```
> \version "2.22.2"
>
> #(define-markup-command (align-on-other layout props axis self-align-dir 
> other-align-dir
>     alignment-markup printed-markup)
>    (index? number? number? markup? markup?)
>    (let* ((stil (interpret-markup layout props printed-markup))
>   (stil-ext (ly:stencil-extent stil axis))
>   (align-stil (interpret-markup layout props alignment-markup))
>   (align-ext (ly:stencil-extent align-stil axis))
>   (trans (- (interval-index align-ext other-align-dir)
>     (interval-index stil-ext self-align-dir
>  (ly:stencil-translate-axis stil trans axis)))
>
> \markup \number \column {
>   \align-on-other #X #RIGHT #RIGHT 9 { 11 10 }
>   6 5 4 3 2 1
> }
> ```

Excellent, thanks!  I like `\align-on-other` very much.

> By the way, are you sur this is the canonical presentation for
> figured bass digits? \figures { <11 10 6 5 4 3 2 1> } seems to do a
> kind of \center-column (using the ad-hoc translation you mentioned),
> which what I would expect ...

I'm still investigating.  Whatever the outcome is, `\align-on-other`
serves all useful possibilities very well and is definitely better
than the current ad-hoc translation.


Werner


Re: within \markup, how to \translate by width of another markup?

2022-05-17 Thread Werner LEMBERG

> Sth like
> 
> \markup \box \number \column \with-dimensions-from \right-align "0"
> \right-align { 11 10 6 5 4 3 2 1 }

While this is an ingenious solution – thanks! – it doesn't fit my
needs, alas, since two-digit numbers stick out to the left of the box.
This is exacerbated by the fact that in figured bass there are
sometimes prepended symbols like '#' – this can cause collisions with
other figured bass stacks on the left side in tight typesetting
situations.

In other words, the horizontal dimension of your solution is (0 . 100)
with some stuff sticking out to the left.  What I want is (-50 . 100),
without something sticking out to the left.

AFAICS, we are back to square one, needing the possibility to
`\translate` something by the width of another markup.  I will cook
something up and see how well it works.


Werner


Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG


>> * Single-digit numbers are left-aligned.
> 
> Why?  They have equal width.  Do you rather mean that the reference
> point is supposed to be on the left edge?

Yes.  Sorry for the sloppy wording.

> What is the alignment supposed to be if there are _only_ two-digit
> numbers?

This situation doesn't happen in figured bass.  Even if there is no
single-digit number (which is very unlikely), the two-digit number has
to be aligned as shown in the drawing to get the positioning right
under the corresponding music.


Werner



Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG

> Again, I have no idea what you are trying to achieve here and how
> kerning has anything to do with it.

OK.  Next try.

Here are the assumptions.

* Numbers 0, 1, 2, ..., 9 all have a width of 100 units.

* Number 10, however, has a kerning of -50 units between digits 0
  and 1, making a total width of 150 (instead of 200).

* I want to stack the numbers 8, 9, 10 vertically so that the digits
  8, 9, and 0 are properly aligned.

* Single-digit numbers are left-aligned.

```
 y ^
   |
   |
   |
   |
++
||
| 10 |
||
++
   | |
   |  9  |
   | |
   +-+
   | |
   |  8  |
   | |
  -x-+--> x
|  | |
  -50  0100
```

As far as I can see, I have to right-align number 10, then shifting it
to the right by the width of a single digit.


Werner


Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG


 The problem at hand is stacking fixed-width single-digit and
 two-digit numbers.  Single-digit numbers should be left-aligned
 for various reasons:

 ```
   9
   8
   7
 ```

 If there is a two-digit number, it should be right-aligned at the
 right edge of the left-aligned single-digit numbers:

 ```
  10
   9
   8
 ```

 My idea was to translate the two-digit number to the left by the
 width of a single digit.

 Is there a solution for this with the current LilyPond markup
 commands?
>>>
>>> I don't understand why you wouldn't use alignment commands for
>>> aligning numbers.
>>
>> I would like to, however, I couldn't find a proper solution.  Do
>> you know one?
>
> \markup \right-column { 10 9 8 7 6 5 4 3 2 1 }
>
> Obviously I am missing something here.

I'm working on `format-bass-figure`.  The vertical alignment of
figured bass digits is 'left-align' by default.  Let's assume that all
digits have the same width but there is kerning between them for
better appearance.  For this reason,

```
\general-align #X #CENTER
```

doesn't align correctly because of the kerning.  Contrary to LaTeX it
seems impossible to right-align stuff on the right edge of
left-aligned stuff because LilyPond doesn't provide an equivalent to
`\hss` (which is a stretchable space).

Currently, `format-bass-figure` uses

```
\translate-scaled-markup #'(-0.7 0) ...
```

where '-0.7' is an ad-hoc value.  I would like to do

```
\translate-scaled-markup-from #X #LEFT { \number "1" } ...
```

instead to avoid the ad-hoc value.


Werner



Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG

> How about
> 
> \markup \typewriter \column { 9 \general-align #X #CENTER 10 }

Nope, this doesn't align properly – see my answer to David's e-mail
for a longer explanation.


Werner


Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG
>> The problem at hand is stacking fixed-width single-digit and
>> two-digit numbers.  Single-digit numbers should be left-aligned for
>> various reasons:
>>
>> ```
>>   9
>>   8
>>   7
>> ```
>>
>> If there is a two-digit number, it should be right-aligned at the
>> right edge of the left-aligned single-digit numbers:
>>
>> ```
>>  10
>>   9
>>   8
>> ```
>>
>> My idea was to translate the two-digit number to the left by the
>> width of a single digit.
>>
>> Is there a solution for this with the current LilyPond markup
>> commands?
>
> I don't understand why you wouldn't use alignment commands for
> aligning numbers.

I would like to, however, I couldn't find a proper solution.  Do you
know one?


Werner



Re: within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG


>> Within a markup, I want to `\translate` an object by the x-extent
>> of another markup.  How can I do that?
>>

>> While we have `\with-dimensions` and friends to adjust the size of
>> an object, it seems to me that we don't have something similar for
>> offsets...  Would it be necessary to define
>> `\translate-with-dimensions` and similar commands?
> 
> Can't you just concat a \with-dimensions ... \null together with
> what you want to see shifted?

I don't think so.  The problem at hand is stacking fixed-width
single-digit and two-digit numbers.  Single-digit numbers should be
left-aligned for various reasons:

```
  9
  8
  7
```

If there is a two-digit number, it should be right-aligned at the
right edge of the left-aligned single-digit numbers:

```
 10
  9
  8
```

My idea was to translate the two-digit number to the left by the width
of a single digit.

Is there a solution for this with the current LilyPond markup
commands?


Werner



within \markup, how to \translate by width of another markup?

2022-05-16 Thread Werner LEMBERG


Within a markup, I want to `\translate` an object by the x-extent of
another markup.  How can I do that?

While we have `\with-dimensions` and friends to adjust the size of an
object, it seems to me that we don't have something similar for
offsets...  Would it be necessary to define
`\translate-with-dimensions` and similar commands?


Werner



Re: An issue with kerning in a defined dynamic "sfffz" solved

2022-05-13 Thread Werner LEMBERG

> Some time ago I wrote saying that I could not get the marking
> "sfffz" to kern properly.  Someone replied that it did for them, and
> I let it sit there, waiting until I needed a solution, which point I
> have now reached.  I have been slow and dense in recognising where
> the issue lies - I am using the BMusicFont (a version of Dorico's
> font, more recent than the "profondo" version).  The kerning works
> in Feta, but not in this font.

By the way, there was a bug in the script that generates the
Emmentaler font (now fixed, see
https://gitlab.com/lilypond/lilypond/-/merge_requests/1353); depending
on the used FontForge version it was possible that there was no
kerning at all for Feta dynamics and numbers.

> I have, however, managed an effective work-around:
> 
>   sfffzX = \markup\center-align\concat{"s" \dynamic"fff" \hspace #-0.5 
> "z"}
>   sfffz = #(make-dynamic-script sfffzX)
> 
> The "s" already kerns ok, and specifying the "fff" dynamic gets the
> fully-kerned version of those letters.  The "z" doesn't kern nicely,
> but can be pushed back to the required position.

Glad that you found a workable solution.  Note, however, that the
kerning problem with 'BMusicFont' is not a LilyPond problem – it
simply passes a string of glyphs to the rendering engine (Pango),
which takes care of applying OpenType features like 'kern'.  Attached
you can see the difference between kerning on and off while using the
Emmentaler font.

```
sfffz = #(make-dynamic-script "sfffz")
sfffzMarkup = \markup {
\override #'(font-features . ("-kern"))
  \dynamic "sfffz" }
sfffzX = #(make-dynamic-script sfffzMarkup)

{ c''2^"with kern" \sfffz }

{ c''2^"without kern" \sfffzX }
```

Maybe there are similar OpenType features present in 'BMusicFont'?
For example, I could imagine that you have to deactivate the 'liga'
feature so that the combination 'f' + 'f' doesn't get converted to
glyph 'ff', which seems to have different kerning (or a lack thereof).


Werner


Re: top-level markup in Scheme

2022-05-13 Thread Werner LEMBERG

>> On the other hand, a LilyPond input file containing only
>> 
>> ```
>> #(make-italic-markup "foo")
>> ```
>> 
>> prints nothing.  I now wonder how I can modify the latter to make
>> it actually work – what is the 'appropriate hook'?
> 
> s/#/$

This did the trick, thanks!  Reading the documentation about '$' with
the benefit of hindsight explains it...


Werner


Re: top-level markup in Scheme

2022-05-13 Thread Werner LEMBERG

>> What is the Scheme equivalent to a top-level markup like
>>
>> ```
>> \markup \italic "foo"
>> ```
>>
>> ?  I can't find it in the documentation.
>
> I am not a fan of the markup macro, but of course
> 
> (make-italic-markup "foo")
> 
> will also work.

Thanks.

> It is not clear what you mean with "top-level" however.  Of course
> at the top level of a LilyPond document, markup gets interpreted by
> calling an appropriate hook.

Well, a LilyPond input file containing only

```
\markup \italic "foo"
```

prints something.  In the NR this usage of `\markup` is called a
'top-level expression'.  How do you call this?

On the other hand, a LilyPond input file containing only

```
#(make-italic-markup "foo")
```

prints nothing.  I now wonder how I can modify the latter to make it
actually work – what is the 'appropriate hook'?


Werner


top-level markup in Scheme

2022-05-13 Thread Werner LEMBERG


What is the Scheme equivalent to a top-level markup like

```
\markup \italic "foo"
```

?  I can't find it in the documentation.


Werner



Re: Annotation brackets,Annotation brackets

2022-05-02 Thread Werner LEMBERG

> I’ve created some code for creating well behaved annotation brackets
> for some SE question, which I want to share with you all in case
> someone of you can use it.

Very nice!  This smells like a good snippet for the LSR :-)


Werner


Re: Unwanted font ligature

2022-04-15 Thread Werner LEMBERG

> I am trying to write the dynamic "sfffz".  But when I write
> \markup\dynamic"sfffz" the first sf is made a ligature, then the
> last two are made another ligature - the difference in spacing of
> the f's is ugly, as in the attached image - is there anything I can
> do about it?

A quick would be to insert U+200B, ZERO WIDTH SPACE (ZWSP) between the
letters to break up the ligatures.  However, I don't get this with the
current development version, see attached image for the code below.


Werner


==


\markup \dynamic "sfffz"

sfffz = #(make-dynamic-script "sfffz")

{ c''\sfffz }


Re: bug in magnetic snapping lyrics engraver

2022-04-14 Thread Werner LEMBERG

>> How did you do that?  Sorry to rain on your parade, but I would not
>> want you to put a lot of work in it if it will not be of mergeable
>> quality.
> 
> Attached.  In the end the necessary modifications were surprisingly
> minor.  Please comment, there is certainly room for improvements.

Attached is another version for testing without the need to patch
LilyPond.


Werner
% magnetic-lyrics.ily
%
%   written by
% Jean Abou Samra 
% Werner Lemberg 
%
% Version 2022-Apr-15

\version "2.23.7"

#(define (Left_hyphen_pointer_engraver context)
   "Collect syllable-hyphen-syllable occurrences in lyrics and store
them in properties.  This engraver only looks to the left.  For
example, if the lyrics input is @code{foo -- bar}, it does the
following.

@itemize @bullet
@item
Set the @code{text} property of the @code{LyricHyphen} grob between
@q{foo} and @q{bar} to @code{foo}.

@item
Set the @code{left-hyphen} property of the @code{LyricText} grob with
text @q{foo} to the @code{LyricHyphen} grob between @q{foo} and
@q{bar}.
@end itemize

Use this auxiliary engraver in combination with the
@code{lyric-@/text::@/apply-@/magnetic-@/offset!} hook."
   (let ((hyphen #f)
 (text #f))
 (make-engraver
  (acknowledgers
   ((lyric-syllable-interface engraver grob source-engraver)
(set! text grob)))
  (end-acknowledgers
   ((lyric-hyphen-interface engraver grob source-engraver)
(when (not (grob::has-interface grob 'lyric-space-interface))
  (set! hyphen grob
  ((stop-translation-timestep engraver)
   (when (and text hyphen)
 (ly:grob-set-object! text 'left-hyphen hyphen))
   (set! text #f)
   (set! hyphen #f)

#(define (lyric-text::apply-magnetic-offset! grob)
   "If the space between two syllables is less than the value in
property @code{LyricText@/.details@/.squash-threshold}, move the right
syllable to the left so that it gets concatenated with the left
syllable.

Use this function as a hook for
@code{LyricText@/.after-@/line-@/breaking} if the
@code{Left_@/hyphen_@/pointer_@/engraver} is active."
   (let ((hyphen (ly:grob-object grob 'left-hyphen #f)))
 (when hyphen
   (let ((left-text (ly:spanner-bound hyphen LEFT)))
 (when (grob::has-interface left-text 'lyric-syllable-interface)
   (let* ((common (ly:grob-common-refpoint grob left-text X))
  (this-x-ext (ly:grob-extent grob common X))
  (left-x-ext
   (begin
 ;; Trigger magnetism for left-text.
 (ly:grob-property left-text 'after-line-breaking)
 (ly:grob-extent left-text common X)))
  ;; `delta` is the gap width between two syllables.
  (delta (- (interval-start this-x-ext)
(interval-end left-x-ext)))
  (details (ly:grob-property grob 'details))
  (threshold (assoc-get 'squash-threshold details 0.2)))
 (when (< delta threshold)
   (let* (;; We have to manipulate the input text so that
  ;; ligatures crossing syllable boundaries are not
  ;; disabled.  For languages based on the Latin
  ;; script this is essentially a beautification.
  ;; However, for non-Western scripts it can be a
  ;; necessity.
  (lt (ly:grob-property left-text 'text))
  (rt (ly:grob-property grob 'text))
  ;; Append new syllable.
  (ltrt (if (and (string? lt) (string? rt))
(string-append lt rt)
(make-concat-markup (list lt rt
  ;; Right-align `ltrt` to the right side.
  (markup (grob-interpret-markup
   grob
   (make-translate-markup
(cons (interval-length this-x-ext) 0)
(make-right-align-markup ltrt)
 (begin
   ;; Don't print `left-text`.
   (ly:grob-set-property! left-text 'stencil #f)
   ;; Set text and stencil (which holds all collected
   ;; syllables so far) and shift it to the left.
   (ly:grob-set-property! grob 'text ltrt)
   (ly:grob-set-property! grob 'stencil markup)
   (ly:grob-translate-axis! grob (- delta) X))


#(define (lyric-hyphen::displace-bounds-first grob)
   ;; Make very sure this callback isn't triggered too early.
   (let ((left (ly:spanner-bound grob LEFT))
 (right (ly:spanner-bound grob RIGHT)))
 (ly:grob-property left 'after-line-breaking)
 (ly:grob-property right 'after-line-breaking)
 (ly:lyric-hyphen::prin

Re: bug in magnetic snapping lyrics engraver

2022-04-14 Thread Werner LEMBERG

>> Attached.  In the end the necessary modifications were surprisingly
>> minor.  Please comment, there is certainly room for improvements.
> 
> Thanks. This is a bit what I feared: in this state, there is
> potential for things going wrong with other after-line-breaking
> callbacks.  Those are the kind of thing that can be buggy in obscure
> circumstances.  I'm a little nervous on having my "off-the-top" /
> "first thing that seemed to work" solution in the code base :-)

I think your code is very clear and easy to understand.  My extensions
aren't complicated either.  It also works nicely and flawless in
combination with the new `VaticanaLyrics` context.  So please be more
specific about your fears.  You told us that you are working on the
breaking algorithm since a few months, so I guess you are the best
person to voice objections and give counterexamples.

Kieren, can you test this, too?

We should probably continue the discussion on lilypond-devel, since it
seems to get bloody technical. :-)

> OTOH, it's *probably* not too difficult to refactor this to use a
> separate 'original-text property and a 'text property computed by a
> callback, with X-offset computed only after-line-breaking, X-extent
> left empty and springs-and-rods doing the magic that would otherwise
> be done by Separation_item::set_distance, at the condition of
> letting Grob::extent skip the X-offset calculation in case the
> extent is found to be empty (which could be a good idea regardless
> actually).

This is way too complicated for me, sorry.

> Or something like that. Too bad that we don't have pure widths (we
> could if I finally managed to finish a big patch that has been
> pending for about a year), but it should be possible to do without I
> think. I think.

Well, I fear I can't help you with the coding if you think this is the
best route to go.  But as usual: The better is the enemy of the
good :-)

> But right now, I'm a bit swamped due to a somewhat important exam
> next Thursday.

I wish you success!

> If you guys are ready to clean up this thing, that would be a relief
> for me given the amount of other contributions that I am trying to
> get around to.

Define 'clean up'.  AFAICS, what you have outlined above is not a
cleanup but a complete reimplementation based on a different
algorithm...


Werner


Re: bug in magnetic snapping lyrics engraver

2022-04-14 Thread Werner LEMBERG

> How did you do that?  Sorry to rain on your parade, but I would not
> want you to put a lot of work in it if it will not be of mergeable
> quality.

Attached.  In the end the necessary modifications were surprisingly
minor.  Please comment, there is certainly room for improvements.


Werner

diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc
index 23cd76bd94..897de7d7f7 100644
--- a/lily/lyric-hyphen.cc
+++ b/lily/lyric-hyphen.cc
@@ -48,6 +48,10 @@ Lyric_hyphen::print (SCM smob)
   && !from_scm (get_property (me, "after-line-breaking"
 return SCM_EOL;
 
+  // Ensure that bounds are displaced first.
+  (void) get_property (bounds[LEFT], "after-line-breaking");
+  (void) get_property (bounds[RIGHT], "after-line-breaking");
+
   Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
 
   Interval span_points;
diff --git a/scm/scheme-engravers.scm b/scm/scheme-engravers.scm
index 07e3be3691..5131beef1f 100644
--- a/scm/scheme-engravers.scm
+++ b/scm/scheme-engravers.scm
@@ -943,6 +943,101 @@ Engraver to print a line between two @code{Fingering} grobs.")))
(description . "Create repeat counts within lyrics for modern
 transcriptions of Gregorian chant.")))
 
+(define (Left_hyphen_pointer_engraver context)
+  (let ((hyphen #f)
+(text #f))
+(make-engraver
+ (acknowledgers
+  ((lyric-syllable-interface engraver grob source-engraver)
+   (set! text grob)))
+ (end-acknowledgers
+  ((lyric-hyphen-interface engraver grob source-engraver)
+   (when (not (grob::has-interface grob 'lyric-space-interface))
+ (set! hyphen grob
+ ((stop-translation-timestep engraver)
+  (when (and text hyphen)
+(ly:grob-set-object! text 'left-hyphen hyphen))
+  (set! text #f)
+  (set! hyphen #f)
+
+(define-public (lyric-text::apply-magnetic-offset! grob)
+  "If the space between two syllables is less than the value in
+property @code{LyricText@/.details@/.squash-threshold}, move the right
+syllable to the left so that it gets concatenated with the left
+syllable.
+
+Use this function as a hook for
+@code{LyricText@/.after-@/line-@/breaking} if the
+@code{Left_@/hyphen_@/pointer_@/engraver} is active."
+  (let ((hyphen (ly:grob-object grob 'left-hyphen #f)))
+(when hyphen
+  (let ((left-text (ly:spanner-bound hyphen LEFT)))
+(when (grob::has-interface left-text 'lyric-syllable-interface)
+  (let* ((common (ly:grob-common-refpoint grob left-text X))
+ (this-x-ext (ly:grob-extent grob common X))
+ (left-x-ext
+  (begin
+;; Trigger magnetism for left-text.
+(ly:grob-property left-text 'after-line-breaking)
+(ly:grob-extent left-text common X)))
+ ;; `delta` is the gap width between two syllables.
+ (delta (- (interval-start this-x-ext)
+   (interval-end left-x-ext)))
+ (details (ly:grob-property grob 'details))
+ (threshold (assoc-get 'squash-threshold details 0.2)))
+(when (< delta threshold)
+  (let* (;; We have to manipulate the input text so that
+ ;; ligatures crossing syllable boundaries are not
+ ;; disabled.  For languages based on the Latin
+ ;; script this is essentially a beautification.
+ ;; However, for non-Western scripts it can be a
+ ;; necessity.
+ (lt (ly:grob-property left-text 'text))
+ (rt (ly:grob-property grob 'text))
+ ;; Append new syllable.
+ (ltrt (if (and (string? lt) (string? rt))
+   (string-append lt rt)
+   (make-concat-markup (list lt rt
+ ;; Right-align `ltrt` to the right side.
+ (markup (grob-interpret-markup
+  grob
+  (make-translate-markup
+   (cons (interval-length this-x-ext) 0)
+   (make-right-align-markup ltrt)
+(begin
+  ;; Don't print `left-text`.
+  (ly:grob-set-property! left-text 'stencil #f)
+  ;; Set text and stencil (which holds all collected
+  ;; syllables so far) and shift it to the left.
+  (ly:grob-set-property! grob 'text ltrt)
+  (ly:grob-set-property! grob 'stencil markup)
+  (ly:grob-translate-axis! grob (- delta) X))
+
+(ly:register-translator
+ Left_hyphen_pointer_engraver 'Left_hyphen_pointer_engraver
+ '((grobs-created . ())
+   (events-accepted . ())
+   (properties-read . ())
+   (properties-written . ())
+   (description . "\
+Collect syllable-hyphen-syllable occurrences in lyrics and store them

Re: bug in magnetic snapping lyrics engraver

2022-04-14 Thread Werner LEMBERG


> There is a problem with ligatures at the syllable boundaries (and
> kerning).  [...]  it is not sufficient to shift the right syllable
> in a syllable pair to the left.  Instead, the following should be
> done.  [...]

Meanwhile I could implement this :-)

I will submit a MR soon.


Werner



Re: how to change extents of a grob?

2022-04-14 Thread Werner LEMBERG


>> Or to ask in a different way: At the time when properties are
>> processed and you have to manipulate stencils, changing the stencil
>> of a grob doesn't change the extents of this grob, AFAICS.
> 
> You are not supposed to change stencils at all.  They are not
> entities with identity.
> 
> Create a new stencil with different dimensions and use that.

OK, thanks.


Werner



how to change extents of a grob?

2022-04-13 Thread Werner LEMBERG


Dear LilyPonders,


I can get the extents of a grob with `ly:grob-extent`.  What is the
corresponding Scheme function to set the extents?

Or to ask in a different way: At the time when properties are
processed and you have to manipulate stencils, changing the stencil of
a grob doesn't change the extents of this grob, AFAICS.  How can I
adjust the extents at this stage to fit the dimensions of the stencil
(even if LilyPond no longer needs and/or uses the values for
positioning)?


Werner



Re: bug in magnetic snapping lyrics engraver

2022-04-13 Thread Werner LEMBERG


>> This is ingenious :-) Thanks *a lot* for this solution.  In my
>> tests it seems to work fine
>
> You're welcome.

I spoke too soon :-) There is a problem with ligatures at the syllable
boundaries (and kerning).  While this can be considered an ugliness in
languages based on the latin script, it might be a real showstopper
for non-latin scripts like Devanagari.

In other words, it is not sufficient to shift the right syllable in a
syllable pair to the left.  Instead, the following should be done.

* Concatenate the text/markup of the left syllable with the right
  text/markup *on the input level* (for example, by using
  `make-concat-markup`) so that Pango/Cairo can handle all affected
  syllables together.

* Store the result in the right syllable and adjust the horizontal
  position.  This allows accumulation for multi-syllable words.

* Set the text/markup in the left syllable to empty.

I tried to implement this, but I failed.  In this replacement code

```
(when (< delta threshold)
  (let ((lt (ly:grob-property left-text 'text))
(rt (ly:grob-property grob 'text)))
(begin
  (ly:grob-set-property!
   left-text 'text empty-markup)
  (ly:grob-set-property!
   grob 'text (make-concat-markup (list lt rt)))
```

the `ly:grob-set-property!` calls have zero effect.  I guess that at
this point of time it is too late for modifying properties, and the
grobs have already been converted to stencils.

Maybe this is the reason for the more complicated approach in David's
original approach?  Do you know a quick fix for your code?


Werner



Re: bug in magnetic snapping lyrics engraver

2022-04-07 Thread Werner LEMBERG
>> Did I miss something?
> 
> Whoops, big problem at line breaks ...

This is ingenious :-) Thanks *a lot* for this solution.  In my tests
it seems to work fine.

Two comments.

* I *strongly* vote for polishing and documenting this so that it can
  be added to LilyPond.  It's an invaluable feature IMHO, greatly
  enhancing Lyrics.

* You have redefined the `LyricHyphen` stencil.  AFAICS, this change
  could be directly integrated into `ly:lyric-hyphen::print`, right?
  Doing so would allow users to change the stencil by themselves if
  necessary.  Otherwise I vote for introducing a property
  `hyphen-formatter` for this job.


Werner



Re: bug in magnetic snapping lyrics engraver

2022-04-07 Thread Werner LEMBERG


> The second bug is super hard to fix: when you tell LilyPond about
> spacing constraints between lyrics, before line breaking, you need
> to assume a lyric syllable won't be moved to the left by
> 'magnetism', because if you do, the spacer might think it can space
> its right neighbor more to the left due to the space left by moving
> the syllable to the left, and if the compression cannot actually be
> done, it will collide.  But when the compression does get done, and
> the room is left empty, horizontal spacing has already been done and
> it is too late to tell the right neighbor that it would have room on
> its left.  Am I making sense?

This makes sense, thanks!


Werner



Re: bug in magnetic snapping lyrics engraver

2022-04-06 Thread Werner LEMBERG

> Here is an example where it fails to position lyrics correctly (see
> last system in the image).

And while we are at it: Here is another bug, already reported in

  https://lists.gnu.org/archive/html/lilypond-user/2020-03/msg00289.html

I've slightly sharpened the test to exclude the possibility of kerning
being the cause of the (buggy) result.


Werner
\version "2.20.0"

\include "magnetic-lyrics.ily"

\new Lyrics \lyricmode {
  "|foobar|" "|foobar|" \break
  foo -- "|bar|" "|foobar|"
}

\layout {
  \context {
\Lyrics
\override LyricWord.after-line-breaking = #(lyric-word-compressor 0.5)
  }

  \context {
\Score
\remove "Bar_number_engraver"
  }
}

\paper {
  indent = 0
  ragged-right = ##t
  system-system-spacing.basic-distance = 0
  system-system-spacing.minimum-distance = 0
  system-system-spacing.padding = 0
}


Re: problem with extending 'magnetic snapping lyrics' engraver

2022-04-06 Thread Werner LEMBERG

>> but how about just
>> changing
>>
>>    (let* ((hyphen-sten (ly:lyric-hyphen::print hyphen))
>>
>> to
>>
>>    (let* ((hyphen-sten (ly:grob-property hyphen 'stencil))
>>
>>
>> ? Then you can do \override LyricHyphen.stencil = #what-you-want to
>> get the result.
> 
> D'oh, so simple, thanks again!

Well, it doesn't work :-) The magnetic snapping engraver sets the
stencil of all affected `hyphen` grobs to `empty-stencil`.  On the
other hand, the solution with a separate property for the formatter to
be accessed with `ly:grob-property-data` seems to work just fine.


Werner


bug in magnetic snapping lyrics engraver

2022-04-06 Thread Werner LEMBERG

Is someone taking care of bugs in the magnetic snapping lyrics
engraver?  Here is an example where it fails to position lyrics
correctly (see last system in the image).


Werner


PS: I've attached a version of `magnetic-lyrics.ily` that actually
works with the current development version (using an updated
`add-grob-definition` routine).

\version "2.23.7"

\include "magnetic-lyrics.ily"

<<
  \new Voice = "foo" \relative c'' {
d1 ~ | d1 | e16 f e2.. ~ | e1 | f1 | d1 |
d1 ~ | d1 | e16 f e2.. ~ | e1 | f1 | d1 |
d1 ~ | d1 | e16 f e2.. ~ | e1 | f1 | d1 |
d1 ~ | d1 | e16 f e2.. ~ | e1 | f1 | d1 |
d1 ~ | d1 | e16 f e2.. ~ | e1 | f1 | d1 |
  }

  \new Lyrics \lyricsto "foo" {
Foo -- bar -- foo -- bar -- foo -- bar.
Foo -- bar -- foo -- bar -- foo -- bar.
Foo -- bar -- foo -- bar -- foo -- bar.
Foo -- bar -- foo -- bar -- foo -- bar.
Foo -- bar -- foo -- bar -- foo -- bar.
  }
>>


\paper {
  indent = 0
  ragged-right = ##f
  line-width = 90\mm
}


\layout {
  \context {
\Lyrics
\override LyricWord.after-line-breaking = #(lyric-word-compressor 0.5)
\override LyricHyphen.minimum-distance = #0
\override LyricSpace.minimum-distance = #1
  }
}
\version "2.23.7"

%% CHANGELOG
%%
%% 2022-04-21 Werner Lemberg
%%
%%   * Update `add-grob-definition` to make it work with current development
%% version (2.23.7).
%%
%% 2019-05-28 Thomas Morley
%% 
%%   * s/map/for-each/.
%%   * Fix comment typo.
%%   * New function `remove-line-starting-hyphens` to exclude line-starting
%% `LyricHyphen`.
%%
%% 2014-03-19
%%
%%   * Initial version.

\header {
  snippet-title = "Magnetic snapping lyric syllables"
  snippet-author = "David Nalesnik, Mike Solomon, Thomas Morley,
Werner Lemberg"
  % snippet-source = 
"http://lists.gnu.org/archive/html/lilypond-user/2014-03/msg00489.html;
  % snippet-source = 
"https://lists.gnu.org/archive/html/lilypond-user/2019-05/msg00388.html;
  snippet-source = 
"https://lists.gnu.org/archive/html/lilypond-user/2022-04/msg00062.html;
  % https://lists.gnu.org/archive/html/lilypond-user/2022-04/msg00062.html
  snippet-description = \markup {
This snippet handles lyric syllables that belong to one word together
and ensures that there are no irritating gaps between them (solves issue 
2458).
  }
  % add comma-separated tags to make searching more effective:
  tags = "lyrics, syllable, gap, hyphen"
  % is this snippet ready?  See meta/status-values.md
  status = "undecided"
}

%%
% here goes the snippet: %
%%

% ADD NEW GROB INTERFACE %%

#(ly:add-interface
  'lyric-word-interface
  "A word of lyrics. Includes syllables and hyphens."
  '(text-items))

%%%

% CREATE NEW GROB PROPERTY 

#(define (define-grob-property symbol type? description)
   (if (not (equal? (object-property symbol 'backend-doc) #f))
   (ly:error (_ "symbol ~S redefined") symbol))

   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc description)
   symbol)

#(for-each
  (lambda (x)
(apply define-grob-property x))

  `(
 (text-items ,list? "Syllables and hyphens of a word of lyrics")))

%%%

 ADD DEFINITION OF GROB %%%

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry #f))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol (interval-length hyphen-ex) threshold)
 '() ; no compression--DO NOTHING!

 (let*
  ((syl-a-text (ly:grob-property syl-a 'text))
   (syl-a-text (if (markup? syl-a-text) syl-a-text (markup syl-a-text)))
   (syl-b-text (ly:grob-property syl-b 'text))
   (syl-b-text (if (markup? syl-b-text) syl-b-text (markup syl-b-text)))
   (full-text (make-concat-markup (list syl-a-text syl-b-text

  (set! (ly:grob-property syl-a 'text) full-text)
  (set! (ly:grob-property syl-b 'text) empty-markup)
  (set! (ly:grob-property syl-a 'stencil) lyric-text::print)
  (set! (ly:grob-property syl-b 'stencil) lyric-text::print)
  (set! (ly:grob-property hyphen 'stencil) empty-stencil)

#(define (lyric-word-compressor threshold)
   (lambda (grob) ; LyricWord
 (let* ((items (ly:grob-ob

Re: problem with extending 'magnetic snapping lyrics' engraver

2022-04-06 Thread Werner LEMBERG

> It's uncomfortable to have grob properties of procedure type, since
> they are automatically resolved as callbacks.  You set
> LyricWord.hyphen-formatter to ly:lyric-hyphen::print.  Then, when
> you do
>
>   (ly:grob-property grob 'hyphen-formatter)
>
> this not only looks up ly:lyric-hyphen::print in the property, but
> executes it on the LyricWord and returns the result.  Since
> ly:lyric-hyphen::print is written to work on a LyricHyphen and not a
> LyricWord, it gives up and returns '().  Then you try to apply the
> "formatter" '() to the hyphen, which goes wrong.  You could use
> ly:grob-property-data, which skips callbacks, [...]

Thanks a lot for the explanation!

> but how about just
> changing
>
>    (let* ((hyphen-sten (ly:lyric-hyphen::print hyphen))
>
> to
>
>    (let* ((hyphen-sten (ly:grob-property hyphen 'stencil))
>
>
> ? Then you can do \override LyricHyphen.stencil = #what-you-want to
> get the result.

D'oh, so simple, thanks again!


Werner


problem with extending 'magnetic snapping lyrics' engraver

2022-04-06 Thread Werner LEMBERG

I'm trying to generalize the 'magnetic snapping lyrics' engraver (the
most recent version posted as
https://lists.gnu.org/archive/html/lilypond-user/2019-05/msg00389.html)
by providing a new property `hyphen-formatter`, to be used instead of
the hard-coded `ly:lyric-hyphen::print`.  Attached you can see the
final file together with a diff to the original version (ignoring
whitespace), and an example.  Unfortunately, it doesn't work, and I
can't find the problem: It aborts with

```
ERROR: Wrong type to apply: ()
```

Please advise.


Werner
\version "2.23.7"

%% CHANGE-LOG harm ()
%%
%% line 52:
%% map becomes for-each
%%
%% line 133:
%% typo in comment
%%
%% lines 234 ff, 260:
%% exclude line-starting LyricHyphen

\header {
  snippet-title = "Magnetic snapping lyric syllables"
  snippet-author = "David Nalesnik, Mike Solomon, harm"
  % snippet-source = 
"http://lists.gnu.org/archive/html/lilypond-user/2014-03/msg00489.html;
  snippet-source = "see 
https://lists.gnu.org/archive/html/lilypond-user/2019-05/msg00388.html;
  snippet-description = \markup {
This snippet handles lyric syllables that belong to one word together
and ensures that there are no irritating gaps between them (solves issue 
2458).
  }
  % add comma-separated tags to make searching more effective:
  tags = "lyrics, syllable, gap, hyphen"
  % is this snippet ready?  See meta/status-values.md
  status = "undecided"
}

%%
% here goes the snippet: %
%%

% ADD NEW GROB INTERFACE %%

#(ly:add-interface
  'lyric-word-interface
  "A word of lyrics. Includes syllables and hyphens."
  '(text-items
hyphen-formatter))

%%%

% CREATE NEW GROB PROPERTY 

#(define (define-grob-property symbol type? description)
   (if (not (equal? (object-property symbol 'backend-doc) #f))
   (ly:error (_ "symbol ~S redefined") symbol))

   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc description)
   symbol)

%% harm:
#(for-each
  (lambda (x)
(apply define-grob-property x))

  `(
(text-items ,list? "Syllables and hyphens of a word of lyrics")
(hyphen-formatter ,ly:stencil? "Stencil for formatting hyphens")))

%%%

 ADD DEFINITION OF GROB %%%

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry #f))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol (interval-length hyphen-ex) threshold)
 '() ; no compression--DO NOTHING!

 (let*
 ((syl-a-text (ly:grob-property syl-a 'text))
  (syl-a-text (if (markup? syl-a-text) syl-a-text (markup 
syl-a-text)))
  (syl-b-text (ly:grob-property syl-b 'text))
  (syl-b-text (if (markup? syl-b-text) syl-b-text (markup 
syl-b-text)))
  (full-text (make-concat-markup (list syl-a-text syl-b-text

   (set! (ly:grob-property syl-a 'text) full-text)
   (set! (ly:grob-property syl-b 'text) empty-markup)
   (set! (ly:grob-property syl-a 'stencil) lyric-text::print)
   (set! (ly:grob-property syl-b 'stencil) lyric-text::print)
   (set! (ly:grob-property hyphen 'stencil) empty-stencil)

#(define (lyric-word-compressor threshold)
   (lambda (grob) ; LyricWord
 (let* ((items (ly:grob-object grob 'text-items))
(item-list (ly:grob-array->list items)))
   (if (> (length item-list) 1) ; do nothing to monosyllabic words
   (let* ((formatter (ly:grob-property grob 'hyphen-formatter))
  (text-grobs
   (filter
(lambda (item)
  (grob::has-interface item 'lyric-syllable-interface))
item-list))
  (hyphen-grobs
   (filter
(lambda (item)
  (grob::has-interface item 'lyric-hyphen-interface))
item-list)))

 (define (helper fmt seed tx-list hy-list)
   (if (and (pair? (cdr tx-list))
(pair? hy-list))
   (let ((next-syl (cadr tx-list))
 (hyphen (car hy-list)))
 (compress-pair fmt seed hyphen next-syl threshold)
 (if (equal? empty-markup (ly:grob-property next-syl 'text))
 (helper fmt seed (cdr tx-list) (cdr hy-list))
 (helper fmt 

Re: Feature request: Fix cascading error messages

2022-03-29 Thread Werner LEMBERG


>> This sounds sensible; maybe this suppression of processing `\score`
>> blocks can be implemented in Scheme so that LilyPond with a special
>> command line option acts as a syntax checker.
> 
> Have you actually tried?  Apart from scores placed in explicit books
> and bookparts, LilyPond already delegates the typesetting until
> after the whole input file has been parsed.

I was mistaken, sorry.


Werner



Re: Feature request: Fix cascading error messages

2022-03-29 Thread Werner LEMBERG


> Why make the user wait so long to make him fix a misspelled word or
> make him put a curly brace? A first pass should be done without
> \score blocks and abort (or at least ask if you want to continue!)
> if this first pass produces errors.

This sounds sensible; maybe this suppression of processing `\score`
blocks can be implemented in Scheme so that LilyPond with a special
command line option acts as a syntax checker.


Werner



Re: Feature request: Fix cascading error messages

2022-03-29 Thread Werner LEMBERG


> But shouldn't Lilypond check first if the syntax is correct instead
> of spending several seconds/minutes compiling a code that's doomed
> to visually fail?

Sometimes I want to see the output inspite of errors.  Aborting
immediately if there is a syntax problem is definitely not always the
best solution.  I fully agree with other people that it should be
Frescobaldi's job to jump to the first error message (in case it
doesn't do this already).

> In this case, the large project argument doesn't hold.  Other than
> that, it seems we have different thresholds to what it means to have
> usable pdf output.  The "service" of a glitchy PDF that Lilypond
> sometimes provides is of questionable value.

Simply check LilyPond's return value.  If it is non-zero you know
there is a problem.  On the other hand, having visual output in case
of errors sometimes help identify where and what the problem is.

TeX behaves quite similarly; IDEs for TeX also have the ability to
jump to errors.


Werner



Re: Feature request: Fix cascading error messages

2022-03-29 Thread Werner LEMBERG

> In this context I could imagine a paramater that kind of highlights
> the first few error messages (or only shows the first N error
> messages) being very forthcoming to some people without a dev
> background. Or maybe at the end of the compilation output a clearly
> marked: "First (few?) Error(s): "

Maybe it would be sufficient to write certain keywords like 'error' or
'warning' with a red color – compilers like gcc or clang emit coloured
messages, for example.


Werner


Re: 'baroque' time signatures

2022-03-21 Thread Werner LEMBERG


> May be you can use something like:
> \override Staff.TimeSignature #'stencil = #ly:text-interface::print
> \override Staff.TimeSignature #'text = \markup \musicglyph #"timesig.C44"
> \time 4/2

Yes, I thought of that, but...

> I'm pretty sure there is a simpler solution, but I don't remember
> it.

... Jean's solution is perfect :-)


Werner



Re: 'baroque' time signatures

2022-03-21 Thread Werner LEMBERG

>> In modern transcriptions of baroque music it is custom to use time
>> signatures for half the length.  For example, if you have 4/2 bar,
>> the time signature shows 'C'; if you have a 6/1 bar, the time
>> signature shows '3/1'.
>>
>> Is there a simple way to get the equivalent to the following
>> (invalid) syntax?
> 
> measureLength should do.
> 
> \version "2.22.2"
> 
> {
>   \time 4/4
>   \set Timing.measureLength = #(ly:make-moment 2)
>   1 1 1 1
>   \time 3/1
>   \set Timing.measureLength = #(ly:make-moment 6)
>   1 1 1 1 1 1
> }

Excellent, thanks a lot!


Werner


'baroque' time signatures

2022-03-21 Thread Werner LEMBERG


In modern transcriptions of baroque music it is custom to use time
signatures for half the length.  For example, if you have 4/2 bar, the
time signature shows 'C'; if you have a 6/1 bar, the time signature
shows '3/1'.

Is there a simple way to get the equivalent to the following (invalid)
syntax?

```
\time 4/2*1/2
\time 6/1*1/2
```


   Werner



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Werner LEMBERG


> A convert-ly rule would probably not be possible given the
> limited power of regular expressions.  As such, \partial might
> need to support both duration and music arguments.  Initially I
> thought this might not be possible, given that a naked duration
> can be treated as music; but the following does seem to work:
>>
>> ...
>> I wouldn't want to have to explain to users why these turn out
>> different.
>> \score {
>>   \fixed c' {
>> \partial 4. 4.
>>   }
>> }
>> \score {
>>   \fixed c' {
>> \partial c4. c4.
>>   }
>> }
>> 
> 
> Fair point, though the intention here would be that backwards
> compatibility would only need to exist for a time.  A warning could
> be issued whenever a user applies the older syntax; this would
> inform the user of the impending breaking change while still
> allowing existing code to compile.  When it is convenient, a future
> release would only support music as the argument.

What about providing a new command `\upbeat` and moving `\partial`
into oblivion?  Compare this to `\tuplet` vs. `\times`.


Werner



Re: `TextSpanner` vs. `DynamicTextSpanner`

2022-03-05 Thread Werner LEMBERG


>> Sometimes, this would be very helpful, yes (see attached image from
>> the last scene of 'Wozzeck').  I guess a possible work-around would
>> be to (ab)use `DynamicTextSpanner` for that.
> 
> [...] There is also this kind of code: [...]  See issue #3176.

Very nice, thanks!  Maybe this should be added?


Werner



Re: `TextSpanner` vs. `DynamicTextSpanner`

2022-03-03 Thread Werner LEMBERG

>> Is there a similar auxiliary grob for `TextSpanner`?
> 
> No, since consecutive text spanners are not aligned vertically.
> 
> {
>   c'1\tweak bound-details.left.text "aaa" \startTextSpan
>   c'1\stopTextSpan\tweak bound-details.left.text ""\startTextSpan
>   c'1\stopTextSpan
> }
> 
> 
> Maybe they should be for tempo indications?

Sometimes, this would be very helpful, yes (see attached image from
the last scene of 'Wozzeck').  I guess a possible work-around would be
to (ab)use `DynamicTextSpanner` for that.

> But then, it's more a matter of adding dedicated grobs since I don't
> think it would be desirable to do this for all text spanners --
> nothing prevents overlapping text spanners, unlike, say, overlapping
> hairpins (in the same voice, that is), so I don't think there is a
> reason to make them continuous.

What do you mean with 'dedicated grobs'?

> What is the context of your question?

I'm working on documentation for all grobs, and I also add cross
references from one grob to similar grobs (if it makes sense).  While
doing that I noticed that `TextSpanner` has no auxiliary grob for
aligning.


Werner


`TextSpanner` vs. `DynamicTextSpanner`

2022-03-03 Thread Werner LEMBERG


For `DynamicTextSpanner` grobs there exists the auxiliary
`DynamicLineSpanner` grob, providing a vertical baseline to align
successive dynamic grobs within a staff.  LilyPond provides other such
pairs like `CenteredBarNumber` vs. `CenteredBarNumberLineSpanner`, or
`SostenutoPedal` vs. `SostenutoPedalLineSpanner`.

Is there a similar auxiliary grob for `TextSpanner`?  


Werner



Re: skip-of-length and \unfoldRepeats

2022-02-16 Thread Werner LEMBERG
>>> Now that I know to look for it, the definition of `\skip` in
>>> 
>>> does describe this behavior.  But I would never have found this on
>>> my own.
>>
>> OK, how did you search exactly?  Where did you look?  What have you
>> missed?  What did you assume?  If you can give those details it
>> might be possible to improve the documentation accordingly.
> 
> Werner, the documentation of \skip on music is a ticket
> at the moment.
> 
> https://gitlab.com/lilypond/lilypond/-/issues/6245

OK, but...

> Given that I am not surprised if people don't find it.

... it is still useful to know how people are searching.


Werner



Re: skip-of-length and \unfoldRepeats

2022-02-15 Thread Werner LEMBERG


>> In recent versions, like version 2.23.6 which you are using, you
>> can use
>>
>>   \skip \musicA
>>
>> which is nicer syntax-wise and plays well with \unfoldRepeats.
> 
> Now that I know to look for it, the definition of `\skip` in
> 
> does describe this behavior.  But I would never have found this on
> my own.

OK, how did you search exactly?  Where did you look?  What have you
missed?  What did you assume?  If you can give those details it might
be possible to improve the documentation accordingly.


Werner



Re: Blind and visually impaired users learning LilyPond

2022-02-13 Thread Werner LEMBERG


> I rather like the idea of there being a section in the documentation
> for visually impaired users; I would even be willing to help
> contribute to such a section.

Excellent, and thanks for the offer.  If you find time to write such a
section, simply send your suggested text to this list, indicating
where to insert it.  We will then discuss it and do the integration
into the documentation.


Werner



Re: edition engraver problems (was: Installing Alternate Music Fonts)

2022-02-10 Thread Werner LEMBERG

>> I haven't had time to /really/ focus on this and I don't want to
>> break everything so what I would like to do is eliminate the
>> MacPorts install and do the official install with the 1.8 version
>> of Guile (I'm guessing Guile 2.2 is what's breaking the scheme
>> functions in Edition Engraver).  But until I have time to focus on
>> it, I don't want to go down that road.
> 
> As far as I can see from quick tests, the Edition Engraver would
> need a few updates for current development versions that are not
> related to Guile 2.

Alas, Urs is out of the game currently for various reasons; it also
seems that Jan-Peter has no time either for the edition engraver
project.

If you have a set of patches to fix those issues please file a pull
request – maybe Urs or Jan-Peter finds time to handle that, or maybe
they can even give you write access.


Werner


Re: Installing Alternate Music Fonts with Frescobaldi and Homebrew Installation on M1 Mac

2022-02-09 Thread Werner LEMBERG


> Werner - I've done just that: The file compiles just fine unless I
> try to change the font.  [...]

This very much smells like a bug in LilyPond's font handling, probably
specific to the Windows platform (otherwise we would have seen from
Abrahan, the author of the Beethoven fonts0.  It might be a problem in
LilyPond itself or in one of the used libraries.

Jonas, do you have any idea how to let Jesse create a backtrace
easily?


Werner



Re: Installing Alternate Music Fonts with Frescobaldi and Homebrew Installation on M1 Mac

2022-02-09 Thread Werner LEMBERG


>> Werner - I've done just that: The file compiles just fine unless I
>> try to change the font.  [...]
> 
> This very much smells like a bug in LilyPond's font handling,
> probably specific to the Windows platform (otherwise we would have
> seen from Abrahan, the author of the Beethoven fonts0.  It might be
> a problem in LilyPond itself or in one of the used libraries.
> 
> Jonas, do you have any idea how to let Jesse create a backtrace
> easily?

Doh, not Windows but Mac, of course.


Werner



Re: Installing Alternate Music Fonts with Frescobaldi and Homebrew Installation on M1 Mac

2022-02-09 Thread Werner LEMBERG

> Looks like it's finding the font in the folder, but then crashing
> midway through the build. Here are the last few lines of the verbose
> output.
> 
> ```
> Preprocessing graphical objects...
> Grob count 1289
> [/opt/local/share/lilypond/2.23.1/fonts/otf/beethoven-11.otf
> CFF name for font beethoven-11 is the same.]
> [/opt/local/share/lilypond/2.23.1/fonts/otf/beethoven-13.otf
> CFF name for font beethoven-13 is the same.]
> [beethoven-13_4.2177734375][1]86953 segmentation fault  lilypond
> --verbose testreed.ly
> ```

Oh, oh.  A crash should never happen.  Please try to reduce your input
file as much as possible to get an MWE (minimal working example) that
still crashes – maybe it crashes with default LilyPond fonts, too?  If
you are done please send the input file to the list.  If some non-free
fonts are necessary to reproduce the problem, don't send them.
Instead, whoever is going to have a closer look at the issue will ask
you to send the fonts privately for further investigation.


Werner


Re: Installing Alternate Music Fonts with Frescobaldi and Homebrew Installation on M1 Mac

2022-02-09 Thread Werner LEMBERG


> Valentin -- That's exactly the path I've been trying to no avail. I
> tracked down that folder but the fonts just aren't being recognized
> as having been installed.

If you call the `lilypond` binary on the command line with

```
lilypond --verbose 
```

You can see where LilyPond tries to find fonts and other files.  Maybe
this helps identify the exact location necessary for installing more
music fonts.


Werner



Re: Delay for list posts to arrive

2022-02-01 Thread Werner LEMBERG


>> Lately I've found myself a couple times duplicating answers already
>> provided on this list by others up to almost three hours earlier
>> because I had not received these replies yet.  [...]
>
> Check the timestamps in the email headers.  This tends to be what I
> see: [...]

There were indeed downtime issues.  You can have a look at

  https://hostux.social/@fsfstatus

to check whether there are known problems.

Note, however, that the GNU mailserver quite often has hiccups due to
heavy loads.


   Werner



Re: Rendering Two Dots Above a Character,Re: Rendering Two Dots Above a Character

2022-01-25 Thread Werner LEMBERG

> Maybe something like this could work.

Nice!  Note, however, that Omid uses

   +  + 

in his input file.  This clearly indicates that he wants the dots
stacked vertically, not horizontally.  Your solution is perfect in
case the vertical stacking is not intended – Unicode provides no means
to 'stack' horizontally.


Werner


Re: Rendering Two Dots Above a Character

2022-01-25 Thread Werner LEMBERG

>> I am trying to create some sort of tablature for Kalimba, treating
>> it like a one-string instrument with fret-labels. I want to use
>> letters like c, ċ, ċ̇ (or cཉ), etc.  I figured there are Unicode
>> characters to do exactly that, "combining dot above" and "combining
>> two dots above", etc.  However, LilyPond does not seem to be able to
>> render "combining two dots above", and two "combining dot above"
>> characters (rendered correctly by my browser, as well as Emacs)
>> result in the two dots to be rendered almost on top of each other in
>> LilyPond.  I have attached a rather minimal example.
> 
> This is a pure font issue, not related to LilyPond at all or the used
> rendering library (Pango).  Your example works just fine with the
> fonts 'Gentium Plus' or 'Charis SIL', for example.  I've slightly
> modified your snippet to show a possible solution.

Attached is an image that shows your example Charis SIL.


Werner


Re: Stem length of beamed notes

2022-01-25 Thread Werner LEMBERG


> \once \override Beam.positions = #'(1 . 0.5) g8 fis
> 
> Indeed, AFAICS this is not clearly documented in the NR manual.

Can you provide a patch?


Werner



Re: Rendering Two Dots Above a Character

2022-01-25 Thread Werner LEMBERG

> I am trying to create some sort of tablature for Kalimba, treating
> it like a one-string instrument with fret-labels. I want to use
> letters like c, ċ, ċ̇ (or cཉ), etc.  I figured there are Unicode
> characters to do exactly that, "combining dot above" and "combining
> two dots above", etc.  However, LilyPond does not seem to be able to
> render "combining two dots above", and two "combining dot above"
> characters (rendered correctly by my browser, as well as Emacs)
> result in the two dots to be rendered almost on top of each other in
> LilyPond.  I have attached a rather minimal example.

This is a pure font issue, not related to LilyPond at all or the used
rendering library (Pango).  Your example works just fine with the
fonts 'Gentium Plus' or 'Charis SIL', for example.  I've slightly
modified your snippet to show a possible solution.


Werner
%%% minimal example start
\version "2.22.1"

notes = \relative c' {
  \time 3/4
  c c' c' |
}

\score {
  <<
\new StaffGroup = "tab with traditional" <<
  \new Staff = "standard" \with {
midiInstrument = "kalimba"
instrumentName = "Kalimba"
  } <<
\clef "treble"
\context Voice = "music" \notes
  >>
  \new TabStaff = "tab" \with {
stringTunings = \stringTuning 
tablatureFormat = #fret-letter-tablature-format
fretLabels = \markuplist {
  \override #'(font-name . "Charis SIL") {
  "c" "_" "d" "_" "e"
  "f" "_" "g" "_" "a" "_" "b"
  "ċ" "_" "ḋ" "_" "ė"
  "ḟ" "_" "ġ" "_" "ȧ" "_" "ḃ"
  "ċ̇" "_" "ḋ̇" "_" "ė̇" } }
  } <<
\tabFullNotation
\context TabVoice = "tab" \notes
  >>
>>
  >>
}
%%% minimal example end


Re: fonts on windows

2022-01-15 Thread Werner LEMBERG


>> Yes, I managed to figure that out. It would be nice if Lilypond
>> could find fonts for the current user too.
> 
> Definitely.  Looks to be an issue with fontconfig [1] and not
> LilyPond.
> 
> [1]: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/144

The issue even has a patch for the problem.  I thus suggest that you
add a comment to the issue, saying that you have been hit by this very
problem, too, and that you would like to see the patch (or a proper
accommodation) being applied for the next release.

This is how development of free software works :-)


Werner



Re: Tenuto marking too close to note

2021-12-28 Thread Werner LEMBERG


> I would like to have the tenuto mark a bit farther away from the
> note.  I had a similar issue with tuplet numbers and then "\override
> TupletNumber.Y-offset = #-2.5" fixed the issue.  I don't know what I
> should replace "TupletNumber" by in the case of tenuto lines.

Have a look at this Visual LilyPond Grob Index:

  https://github.com/joram-berger/visualindex/files/7787574/visualindex-2.23.pdf

Almost all shown elements are clickable, linking to the corresponding
documentation.

It is work in progress and intended for the current development
version (for example, `SegnoMark` doesn't exist in 2.22), but I guess
it could help in such situations.


Werner



Re: better control of balloon positioning

2021-12-26 Thread Werner LEMBERG
>> [...] What must I do to get, for example,
>>
>>Balloon text
>>   /
>>  /
>>  grob
>>
>> this alignment?  Please advise.
>
> One solution is to wait for the patch that accidentally I am
> preparing exactly right now. :=)

Aaah :-)


Werner



better control of balloon positioning

2021-12-26 Thread Werner LEMBERG


A balloon's `X-offset` property results in the following three
alignments for a given x value.

  x < 0:  Balloon text
  \
   \
grob

  x = 0: Balloon text
  |
  |
grob

  x > 0:  Balloon text
 /
/
grob

This shows that `X-offset` controls the attach point alignment on both
sides of the annotation line, which is certainly a good default.
However, it isn't sufficient in crowded situations.  What must I do to
get, for example,

  Balloon text
 /
/
grob

this alignment?  Please advise.


Werner



Iranian classical music support

2021-12-14 Thread Werner LEMBERG


Dear LilyPond community,


based on Kees van den Doel's `persian.ly`, I've submitted a Merge
Request to integrate support for Iranian classical music into
LilyPond.

  https://gitlab.com/lilypond/lilypond/-/merge_requests/1060

Please comment (and ideally, revise)!

You have to sign in to comment on gitlab.com; if you don't like this,
send your comments to the LilyPond mailing list(s).


Werner



Re: Crescendo after custom dynamic marking

2021-12-13 Thread Werner LEMBERG


> c): Add \dynamic know and later find a special name for Harm's
> dynamic engine.

(d) You add now `\dynamic` in a first MR.  Eventually, Harm's stuff
gets applied in another MR under the same name, extending your
stuff.[*] IMHO there is no necessity to provide `convert-ly` rules
between development versions, especially since the LilyPond's
current micro version is still a single digit.


  Werner


[*] Under the assumption that this actually makes sense.



Re: Persian accidentals (koron and sori)

2021-12-06 Thread Werner LEMBERG

> One comment: When looking at Fig. 11 in your PDF, two suggestions
> came to my mind.  The handwritten accidentials show some less sharp
> edges because the ink is flowing in the inner angles of the glyph.
> As you already take the liberty to match the style of classical
> accidentials, how about avoiding some sharp inner angles by
> 
> 1. filling the tiny white triangle in the sharp-like glyph (I am less
>convinced)

I won't do that – I trust that it happens automatically :-)

> 2. making the right inner angle round (looks good to me)

Mhmm, I don't like this, especially if the koron is positioned between
staff lines.  Additionally, Emmentaler doesn't use rounded corners in
the inside of glyphs in general.

However, I'm going to redesign this glyph soon to make it blend even
better with Emmentaler.

> I have two images attached where the additinal ink is painted in red
> and in black.

Thanks.  By the way, here is a link that shows the two new glyphs at
all available Emmentaler sizes:

  
https://gitlab.com/lilypond/lilypond/uploads/b40d4d586ddb994f91be7c650d808833/iranian.pdf


Werner


Re: Persian accidentals (koron and sori)

2021-12-06 Thread Werner LEMBERG


>>> https://w3c.github.io/smufl/latest/tables/persian-accidentals.html
>> 
>> Yes, and it is soo ugly.
> 
> It is best consulting some with traditional Persian sheet music.
> But the few ones I have seen tend to be hand drawn, not of very high
> quality, but similar.
> 
> The accidentals were designed by Ali-Naqi Vaziri, and became popular
> for use in Persian sheet music.
> 
> https://en.wikipedia.org/wiki/Ali-Naqi_Vaziri

I know, thanks.  Here you can find some glyph examples

  https://corp.unicode.org/~roozbeh/sori-koron.pdf


Werner



Re: Persian accidentals (koron and sori)

2021-12-06 Thread Werner LEMBERG


>> In case there are experts on Persian music notation: please have a
>> look here
>> 
>>  https://gitlab.com/lilypond/lilypond/-/merge_requests/1047
>> 
>> and comment on the design.
> 
> Here is how they look at SMuFL. Rather thin and of equal thickness,
> contrary to the standard accidentals.
> 
> https://w3c.github.io/smufl/latest/tables/persian-accidentals.html

Yes, and it is soo ugly.


Werner



Persian accidentals (koron and sori)

2021-12-06 Thread Werner LEMBERG


In case there are experts on Persian music notation: please have a
look here

  https://gitlab.com/lilypond/lilypond/-/merge_requests/1047

and comment on the design.


Werner



Re: `\textLengthOn` for `TextSpanner` grobs

2021-11-30 Thread Werner LEMBERG


>>> Does David N's text-spanner work solve this problem, I wonder?
>> What are you referring to?
> 
> https://github.com/davidnalesnik/lilypond-text-spanner-inner-texts

This is veeery nice!  Thanks for the link.


Werner



Re: `\textLengthOn` for `TextSpanner` grobs

2021-11-28 Thread Werner LEMBERG

Hello Kieren,


>>> Use
>>>   \override TextSpanner.minimum-length = 30
>>>   \override TextSpanner.springs-and-rods = #ly:spanner::set-spacing-rods
>> Thanks.  Alas, doesn't work correctly for broken spanners
> 
> Yeah, I saw that coming… as well as the fundamental
> "trial-and-error" problem.

:-)

>> I also wonder whether there is a solution (or should be a solution)
>> that doesn't need manual entering of a minimum length value that
>> can only be found by trial and error.
> 
> Does David N's text-spanner work solve this problem, I wonder?

What are you referring to?


Werner


Re: `\textLengthOn` for `TextSpanner` grobs

2021-11-28 Thread Werner LEMBERG
>> please have a look at this example
>>
>> ```
>> {
>>\set Score.skipBars = ##t
>>\override TextSpanner.bound-details.left.text = "poco a poco tempo I"
>>\override TextSpanner.bound-details.right.text = "Tempo I"
>>R1*4\startTextSpan |
>>R1\stopTextSpan
>> }
>> ```
>>
>> What is the equivalent of `\textLengthOn` for `TextSpanner` grobs so
>> that the multi-measure rest gets properly stretched horizontally?
>
> Use
>
>   \override TextSpanner.minimum-length = 30
>   \override TextSpanner.springs-and-rods = #ly:spanner::set-spacing-rods

Thanks.  Alas, doesn't work correctly for broken spanners:

```
\paper {
  line-width = 100\mm
}

{
  \set Score.skipBars = ##t
  \override TextSpanner.bound-details.left.text = "poco a poco tempo I"
  \override TextSpanner.bound-details.left-broken.text = ""
  \override TextSpanner.bound-details.right.text = "Tempo I"
  \override TextSpanner.bound-details.right-broken.text = ""
  \override TextSpanner.minimum-length = 34
  \override TextSpanner.springs-and-rods = #ly:spanner::set-spacing-rods

  R1*4\startTextSpan | \break
  R1*4\stopTextSpan |
  R1 |
}
```

I also wonder whether there is a solution (or should be a solution)
that doesn't need manual entering of a minimum length value that can
only be found by trial and error.  For example, wouldn't it be
sensible to have the possibility of

```
\override TextSpanner.bound-details
.left.extra-spacing-height = #'(-inf.0 . +inf.0)
\override TextSpanner.bound-details
.right.extra-spacing-height = #'(-inf.0 . +inf.0)
```

in combination with the `extra-spacing-width` property to get
automatically the correct value(s)?


 Werner


`\textLengthOn` for `TextSpanner` grobs

2021-11-28 Thread Werner LEMBERG

Folks,


please have a look at this example

```
{
  \set Score.skipBars = ##t
  \override TextSpanner.bound-details.left.text = "poco a poco tempo I"
  \override TextSpanner.bound-details.right.text = "Tempo I"
  R1*4\startTextSpan |
  R1\stopTextSpan
}
```

What is the equivalent of `\textLengthOn` for `TextSpanner` grobs so
that the multi-measure rest gets properly stretched horizontally?


Werner



\tag and \tweak

2021-11-26 Thread Werner LEMBERG


This time a syntax question: Is it possible to combine `\tag` with
`\tweak`?  I have tried the following:

  g-\tag #'score \tweak X-offset #-3
 _\markup { "foo" } |

However, this makes the `\markup` disappear if `\keepWithTag` doesn't
contain `#'score` (which is kind-of logical).

In case there isn't a nifty trick I will prepare a patch for NR to
explicitly state that `\tag` doesn't work with `\tweak`.


Werner



Re: quoted tuplet bracket within staff

2021-11-26 Thread Werner LEMBERG
 
>> Well, you got the wrong property here.  outside-staff-priority
>> tells how to stack outside-staff objects with one another.  What
>> you need here is
>>
>>  \override CueVoice.TupletBracket.staff-padding = ##f

Aah, I only tried `padding` to no avail.  Thanks a lot!

> So, Werner, this should be the solution you were looking for?

Yes, that's it!

Again, thanks a lot to all of you wonderful guys who provided a
solution within a few hours.

Below is what I'm going to use.


Werner


==


tuplet-up = {
  \override CueVoice.TupletBracket.staff-padding = ##f
  \override CueVoice.TupletBracket.padding = #1.5
  \override CueVoice.TupletBracket.direction = #UP
}

x = { r2 \tuplet 3/2 { g4 a b } r2 \tuplet 3/2 { c'4 a g } }

\addQuote "qx" \x

{
  r2 \cueDuring #"qx" #DOWN {
\tuplet-up
r2 r2 r2
  }
}



Re: quoted tuplet bracket within staff

2021-11-26 Thread Werner LEMBERG


>> For a general solution, one could probably write a callback for the
>> positions property.
> 
> I was hoping to use #'outside-staff-priority to try to allow the
> tuplet to float into the staff automatically, [...]

Me too.


Werner



Re: quoted tuplet bracket within staff

2021-11-26 Thread Werner LEMBERG

>>\override CueVoice.TupletBracket.direction = #DOWN
>>\override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7)
>>\override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75)
>>\override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75)
> 
> Hold the heavy machinery :-). You can just set the positions directly:
> 
>     \override CueVoice.TupletBracket.positions = #'(-2 . -1)
>     \override CueVoice.TupletBracket.direction = #UP

Nice, thanks.

> For a general solution, one could probably write a callback for the
> positions property. How difficult this is probably depends on the
> use case: Werner, how similar are the instances in your score?  Can
> we assume a monotonous sequence of pitches? May we assume that the
> bracket should always be above?

I need this to make the staves use less vertical space so that more
staves can be added to a part page.  This means that a solution with
`extra-offset` is not helpful.  Additionally, walking over all
triplets is tedious; there are a lot of them...

However, Kieren's approach is nice: It takes the slant of the beam and
simply shifts it up.  In general I think this is what I want: Use the
original slant and shift the bracket up until it no longer collides
with the note heads (plus some padding).


Werner


Re: quoted tuplet bracket within staff

2021-11-26 Thread Werner LEMBERG

>> What must I do to make the tuplet bracket be positioned within the
>> staff, that is, below the rest?
> 
> There's surely a more elegant way… but if you're stuck, you can
> always hack it: [...]

Thanks a lot!  Of course I would like to have a solution that avoids
`extra-offset` :-)

>  x = { r2 \tuplet 3/2 { g4 a b } }
> 
>  \addQuote "qx" \x
> 
>  {
>r2 \cueDuring #"qx" #DOWN {
>  \override CueVoice.TupletBracket.direction = #DOWN
>  \override CueVoice.TupletBracket.edge-height = #'(-0.7 . -0.7)
>  \override CueVoice.TupletBracket.extra-offset = #'(0 . 4.75)
>  \override CueVoice.TupletNumber.extra-offset = #'(0 . 4.75)
>  r2
>}
>  }

Of course, the next question is how to have such a setting globally so
that I don't have insert the bunch of overrides again and again...


Werner


quoted tuplet bracket within staff

2021-11-26 Thread Werner LEMBERG

Folks,


plesae consider the following example.

  x = { r2 \tuplet 3/2 { g4 a b } }

  \addQuote "qx" \x

  {
r2 \cueDuring #"qx" #DOWN {
  \override CueVoice.TupletBracket.direction = #UP
r2 }
  }

What must I do to make the tuplet bracket be positioned within the
staff, that is, below the rest?


Werner


Re: Help

2021-11-20 Thread Werner LEMBERG


> Nevetheless, in my modest opinion, the easiness of modern notation
> in LilyPond would be greatly upgraded if one might take the book of
> Edgard Karkoschka on the XX century notation and check out most
> common features used by all composers discussed in this very
> informative book

This is certainly true.  However, who is 'one'?  Maybe you?

> In comparison to enormously rich resources devoted in documentation
> to ancient and medieval notation (circa 100 noteheads only!),

Well, the author of Gregorian chant notation support was very
interested in this topic and contributed both code and documentation.


Werner



<    1   2   3   4   5   6   7   8   9   10   >