lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colored box behind a single note


From: David Kastrup
Subject: Re: Colored box behind a single note
Date: Thu, 25 Jul 2019 10:53:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Werner LEMBERG <address@hidden> writes:

>> Using
>> 
>>   http://lsr.di.unimi.it/LSR/Item?id=1000
>> 
>> I wonder how to get the effect for a single note.  Ideally, I would
>> like to write
>> 
>>   \genericSpan <...parameters ...>
>>   e\startGroup\stopGroup
>
> With the attached patch (for git master) I get exactly that :-)
>
> Not sure whether the coding fits lilypond's C++ style, however.

Seriously?  C++ has loops, you don't need goto for that.  But the
semantics are worse.

> +  // One single-moment bracket is allowed.  Abbreviating a horizontal
> +  // bracket's `START' span-direction with `L' and `STOP' with `R', this
> +  // means that we can have
> +  //
> +  //   LLL...LLR
> +  //
> +  // or
> +  //
> +  //   LRRR...RR
> +  //
> +  // events attached to a single moment (we don't take care of the order of
> +  // `L' and `R' events).
> +
>    if (d == STOP)
>      {
>        pop_count_++;
> -      if (pop_count_ > bracket_stack_.size ())
> +      if (pop_count_ > bracket_stack_.size () + 1)

[...]

> \include "ColorSpanDef.ily"
>
> \new Staff {
>   \override HorizontalBracket.line-thickness = #0
>   \genericSpan #-4 #-2 #-4 #-2
>     \colDarkRed \colLightRed #0 #0 ##f ##f
>   <c' d'>2\startGroup\stopGroup
>
>   c'4\startGroup\startGroup\stopGroup
>   c'4\startGroup\stopGroup\stopGroup
> }
>
> \layout {
>   \context {
>     \Voice
>     \consists "Horizontal_bracket_engraver"
>   }
> }

If the resulting semantics and the allowed and not allowed constructs
cannot be described in a reasonably straightforward manner with
reasonably straightforward code, we should strive for something more
coherent, even if it means a larger effort in coding at the program
(rather than the user) level.  Try-it-until-it-works features are
indistinguishable from bugs and could work differently in future
versions.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]