lilypond-user
[Top][All Lists]
Advanced

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

Re: functions to ignore grob during spacing calculations


From: David Kastrup
Subject: Re: functions to ignore grob during spacing calculations
Date: Tue, 15 Aug 2017 19:52:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Kieren MacMillan <address@hidden> writes:

> Hello all,
>
> In the following snippet, there are three macros which "trick" the
> spacing engine into ignoring a grob during horizontal and/or vertical
> spacing calculations:
>
> %%%%  SNIPPET BEGINS
> \version "2.19.64"
>
> ignoreH =
>     \tweak horizontal-skylines #f
>     \tweak extra-spacing-width #empty-interval
>     \etc
>
> ignoreV =
>     \tweak vertical-skylines #f
>     \tweak extra-spacing-height #empty-interval
>     \etc
>
> ignore = \ignoreH \ignoreV \etc
>
> { c''4\fffff c''-\fffff c''2\fffff }
>
> { c''4\fffff c''-\ignore -\fffff c''2\fffff }
>
> %{ \ignore DynamicText c''4\fffff c''-\fffff c''2\fffff } % uncomment
> this to see the problem
> %%%%  SNIPPET ENDS

It helps to actually test the programs: there are warnings about bad
values for horizontal-skylines and vertical-skylines because #f isn't
the same as ##f .

> I'd like to have a non-tweak version of this behaviour, which can be
> turned on and off (or used \once) in a given context. But I'm unsure
> of the best way of implementing it. (Uncommenting the last
> [pseudo-code] line of the snippet shows the problem with the naive
> approach.) I tried to create a music function, but couldn't figure out
> how to abstract the grob type (which is obviously essential, if this
> function is to be universally applicable).
>
> Any pointers or hints would be appreciated.

You are probably not going to like it.

%%%%  SNIPPET BEGINS
\version "2.19.64"

ignoreH =
    \propertyTweak horizontal-skylines ##f
    \propertyTweak extra-spacing-width #empty-interval
    \etc

ignoreV =
    \propertyTweak vertical-skylines ##f
    \propertyTweak extra-spacing-height #empty-interval
    \etc

ignore = \ignoreH \ignoreV \etc

{ c''4\fffff c''-\fffff c''2\fffff }

{ c''4\fffff c''-\ignore -\fffff c''2\fffff }

{ \ignore DynamicText c''4\fffff c''-\fffff c''2\fffff }
%%%%  SNIPPET ENDS
\propertyTweak is basically the same function as \tweak except that it
also works on grob specs.  The difference is particularly important in
\lyricsmode where grob specs are often indistinguishable from normal
text.  So \tweak does not admit them.

-- 
David Kastrup

reply via email to

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