openlilylib / analysis

Graphical highlighting of musical analysis with GNU LilyPond
GNU General Public License v3.0
5 stars 3 forks source link

Frames don't seem to properly have an Y-Extent #12

Closed uliska closed 9 months ago

uliska commented 5 years ago

When creating a score using lilypond-book-preamble.ly I realized that frames are cropped - which usually is a symptom of custom-drawn elements not properly handling their Y-extent. Generally when drawing something one should manually set the extent if one wants the element to participate in collision handling and/or avoiding cropping (be it through the system-wise slicing or simply the top edge of the paper).

KlausBlum commented 5 years ago

Hmm... I never cared about that. I realized from the beginning that the frames are not recognized for LY's spacing decisions, but I thought that doesn't matter. I didn't think of lilypond-book-preamble.ly. Here are two things that first came into my mind:

1) I don't know how to set the Y- (and X-) extent manually. But I'm sure there are people who can help.

2) As long as a frame has no extent, it's "invisible" to LilyPond and behaves "neutral". If that changes, would a frame consume space on it's own, i.e. push other things away? IMO that would be fatal and make them unusable.

uliska commented 5 years ago

I think that setting an extent (how to do that depends on how and when the frames are drawn) and setting the ignore-collisions property might be the solution. Maybe I'll look into it tomorrow.

KlausBlum commented 5 years ago

I'm playing around with Snippet 960: http://lsr.di.unimi.it/LSR/Item?u=1&id=960 on which the "frames" module is based. It seems that \once\override HorizontalBracket.Y-extent = ... could be a start.

KlausBlum commented 5 years ago

Error in attached file... here is the right one:

Y-extent Test.ly.txt

KlausBlum commented 5 years ago

Here is what I have so far: As you can see, I've worked on the "caption" branch because it contains the newest additions (rotation and captions) that need some effort to calculate the frame's stencil extent. This calculation itself should work now. However, only setting the Y-Extent has an effect. I've used (ly:grob-set-property! grob 'X-extent (car stencil-ext)) (ly:grob-set-property! grob 'Y-extent (cdr stencil-ext)) and setting the X-Extent is not recognized.

As for collision handling, it seems that the frames themselves still don't have an effect on other object's positioning. However, caption labels are markup objects that consume space of their own. Playing with the ignore-collision property did not work for me. IIUC this is only a property of the NoteColumn grob which is not interesting here.

KlausBlum commented 9 months ago

Merged 21.06.2020
Not a perfect solution, but a usable workaround, see example document.
New properties: set-top-edge (##f) set-bottom-edge (##f) set-left-edge (##f) set-right-edge (##f) set-caption-extent (##f)