\override ClefModifier.text has no effect

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

\override ClefModifier.text has no effect

Malte Meyn-3
Hi list,

I’m not sure: Is this a bug? According to the Internals Reference,
ClefModifier has ly:text-interface::print as a stencil and should use
the 'text property. But the following doesn’t show “8va” as expected but
“8”:

\version "2.21.0" % same for 2.19.82, 2.18.2
{
   % make sure the correct grob is targeted
   \override Staff.ClefModifier.color = #red
   % nothing happens:
   \override Staff.ClefModifier.text = "8va"
   \clef "treble^8"
   R1
}

I suppose that there’s a reason for that behaviour (maybe in the
definition of the \clef command?) but could be considered a bug
nevertheless. I found the following workaround but it’s not very
comfortable:

{
   \override Staff.ClefModifier.before-line-breaking =
   #(lambda (grob)
      (ly:grob-set-property! grob 'text "8va"))
   \clef "treble^8"
   R1
}

Cheers,
Malte

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \override ClefModifier.text has no effect

David Kastrup
Malte Meyn <[hidden email]> writes:

> Hi list,
>
> I’m not sure: Is this a bug? According to the Internals Reference,
> ClefModifier has ly:text-interface::print as a stencil and should use
> the 'text property.

It does.  It just does not look whether the user has set it.

> But the following doesn’t show “8va” as expected but “8”:
>
> \version "2.21.0" % same for 2.19.82, 2.18.2
> {
>   % make sure the correct grob is targeted
>   \override Staff.ClefModifier.color = #red
>   % nothing happens:
>   \override Staff.ClefModifier.text = "8va"
>   \clef "treble^8"
>   R1
> }
>
> I suppose that there’s a reason for that behaviour (maybe in the
> definition of the \clef command?) but could be considered a bug
> nevertheless. I found the following workaround but it’s not very
> comfortable:
>
> {
>   \override Staff.ClefModifier.before-line-breaking =
>   #(lambda (grob)
>      (ly:grob-set-property! grob 'text "8va"))
>   \clef "treble^8"
>   R1
> }

The problem is that as of

commit 74b4c9351b01381f0dc1d6d4688dcd845fc59720
Author: Marc Hohl <[hidden email]>
Date:   Sat Oct 27 22:22:25 2012 +0200

    Allows optional octavation for clefs
   
    Clef specifications like \clef "G_(8)" or
    \clef "bass^[15]" are supported.
   
    A new property clefOctavationStyle (and its cue
    clef couterpart cueClefOctavationStyle) is introduced.
    When set to 'default, the octavation number is displayed
    as before; 'parenthesized calls for parenthesized numbers
    and 'bracketed used brackets around the number.
   
    Furthermore, a scheme formatter function is used for
    displaying the ocatavation number, so can be customized
    more easily.

a number of _context_ variables for formatting the clef modifier have
been introduced and any grob callback placed in the 'text field would be
unable to take those into account.  One would need to redesign the
interface so that any grob callback would be able to access the
necessary information and then one could do the work in the callback,
making it both feasible for a user to replace not just the stencil
(which should be possible still I think, but have not checked) but also
the text and have the standard text->stencil callback for the stencil
property.

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \override ClefModifier.text has no effect

James Lowe-3
In reply to this post by Malte Meyn-3
Hello,


On 15/08/18 11:19, Malte Meyn wrote:

> Hi list,
>
> I’m not sure: Is this a bug? According to the Internals Reference,
> ClefModifier has ly:text-interface::print as a stencil and should use
> the 'text property. But the following doesn’t show “8va” as expected
> but “8”:
>
> \version "2.21.0" % same for 2.19.82, 2.18.2
> {
>   % make sure the correct grob is targeted
>   \override Staff.ClefModifier.color = #red
>   % nothing happens:
>   \override Staff.ClefModifier.text = "8va"
>   \clef "treble^8"
>   R1
> }
>
> I suppose that there’s a reason for that behaviour (maybe in the
> definition of the \clef command?) but could be considered a bug
> nevertheless. I found the following workaround but it’s not very
> comfortable:
>
> {
>   \override Staff.ClefModifier.before-line-breaking =
>   #(lambda (grob)
>      (ly:grob-set-property! grob 'text "8va"))
>   \clef "treble^8"
>   R1
> }
>
> Cheers,
> Malte

We mention (something related to) this in our NR

http://lilypond.org/doc/v2.19/Documentation/notation-big-page.html#clef

Known Issues and warnings - where we actually use a coloured example.

Is this kind of what David was talking about or do we need to improve
what we state there?

James

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \override ClefModifier.text has no effect

David Kastrup
James Lowe <[hidden email]> writes:

> Hello,
>
>
> On 15/08/18 11:19, Malte Meyn wrote:
>> Hi list,
>>
>> I’m not sure: Is this a bug? According to the Internals Reference,
>> ClefModifier has ly:text-interface::print as a stencil and should
>> use the 'text property. But the following doesn’t show “8va” as
>> expected but “8”:
>>
>> \version "2.21.0" % same for 2.19.82, 2.18.2
>> {
>>   % make sure the correct grob is targeted
>>   \override Staff.ClefModifier.color = #red
>>   % nothing happens:
>>   \override Staff.ClefModifier.text = "8va"
>>   \clef "treble^8"
>>   R1
>> }
>>
>> I suppose that there’s a reason for that behaviour (maybe in the
>> definition of the \clef command?) but could be considered a bug
>> nevertheless. I found the following workaround but it’s not very
>> comfortable:
>>
>> {
>>   \override Staff.ClefModifier.before-line-breaking =
>>   #(lambda (grob)
>>      (ly:grob-set-property! grob 'text "8va"))
>>   \clef "treble^8"
>>   R1
>> }
>>
>> Cheers,
>> Malte
>
> We mention (something related to) this in our NR
>
> http://lilypond.org/doc/v2.19/Documentation/notation-big-page.html#clef
>
> Known Issues and warnings - where we actually use a coloured example.
>
> Is this kind of what David was talking about or do we need to improve
> what we state there?

I'd say neither.  The expectation that no grob property will be
overriden given a user-defined default is not borne out by reality.
This works for information established by callbacks, but not generally
for information created by engravers.  Sometimes you can impose such
properties using \overrideProperty, but it's not guaranteed that they
arrive in time.

--
David Kastrup


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond