[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tweaking Hairpin shape
From: |
David Nalesnik |
Subject: |
Re: Tweaking Hairpin shape |
Date: |
Tue, 6 Feb 2018 08:04:10 -0600 |
Hi Stefano,
On Mon, Feb 5, 2018 at 11:53 PM, Stefano Troncaro
<address@hidden> wrote:
> David and Harm, I'm really impressed by the level of expertise you both have
> showed in this thread. The function works wonderfully, and I'm really
> grateful for your help!
>
> I feel kind of bad for asking, but I'm stuck after trying to do what I
> thought would be a minor tweak. I wanted to make it so that the two lines
> that form the hairpin would end in the same vertical line, since when the
> hairpin is rotated the end-points of the two lines are displaced. I tried
> achieve this by drawing a white box that overlaps with the line that
> overextends, therefore "deleting" the excess.
>
> While I could not always place the box correctly, due to how
> ly:stencil-stack works (I don't explain this further because of the
> following), the real problem I found is that even when the box is properly
> placed, the shortened line looks off. This is because Lilypond naturally
> makes line endings smooth, so the "cut the excess with a box" approach
> creates a hairpin with one line ending smoothly and the other ending
> harshly. This is less evident for thinner lines but is easy to see with
> thicker ones. Another flaw of this approach is that the white box reserves
> unused space.
>
> So, with that in mind, I wonder: is there a way to smoothen the line after
> "cutting" it (which I doubt) or, lacking that, is there a way to access only
> one line of the hairpin to shorten it by the necessary amount? The later I
> imagine like a Hairpin.shorten-pair that affects only one of the two lines.
> Alternatively, is it more sensible to just draw the two lines and stack them
> into a stencil? I have not yet tried this but the more I think about it the
> more it looks like the most viable option. I tried to search the definition
> of ly:hairpin::print to see how Lilypond does this, but I couldn't find it.
At this point I think you would get the best results by rewriting
ly:hairpin::print from scratch so that it has the existing
functionality with your enhancements worked in.
At some point I translated the function from C++ into Scheme for some
experimentation. It's fairly direct. I found a version of this where
I left the original C++ code inlined as comments
(add-shorten-pair.ly).
I used this as a preliminary to adding 'shorten-pair directly into the
C++ code, and I don't remember if I made improvements to the codebase
along the way...
Hopefully, you can make use of it!
I also located a file which shows what you can do from scratch: here
adjusting the size of the circle in the circled tip (not with
shorten-pair here...) FWIW.
Hope this helps...
David
add-shorten-pair.ly
Description: Text Data
hairpin-scheme-enhanced.ly
Description: Text Data
- Re: Tweaking Hairpin shape, (continued)
- Re: Tweaking Hairpin shape, Kieren MacMillan, 2018/02/04
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/04
- Re: Tweaking Hairpin shape, Thomas Morley, 2018/02/04
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/04
- Re: Tweaking Hairpin shape, David Nalesnik, 2018/02/04
- Re: Tweaking Hairpin shape, Thomas Morley, 2018/02/04
- Re: Tweaking Hairpin shape, David Nalesnik, 2018/02/04
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/06
- Re: Tweaking Hairpin shape, Werner LEMBERG, 2018/02/06
- Re: Tweaking Hairpin shape, Andrew Bernard, 2018/02/06
- Re: Tweaking Hairpin shape,
David Nalesnik <=
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/06
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/06
- Re: Tweaking Hairpin shape, Werner LEMBERG, 2018/02/06
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/06
- Re: Tweaking Hairpin shape, Thomas Morley, 2018/02/06
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/08
- Re: Tweaking Hairpin shape, David Nalesnik, 2018/02/08
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/10
- Re: Tweaking Hairpin shape, David Nalesnik, 2018/02/10
- Re: Tweaking Hairpin shape, Stefano Troncaro, 2018/02/11