Thank you David! I think I should be able to work something out from here,
I'll post again when I have some kind of update.

2018-02-06 11:04 GMT-03:00 David Nalesnik <david.nales...@gmail.com>:

> Hi Stefano,
>
>
> On Mon, Feb 5, 2018 at 11:53 PM, Stefano Troncaro
> <stefanotronc...@gmail.com> 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
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to