[Top][All Lists]

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

Getting width of markup in a music function

From: Nathan Reed
Subject: Getting width of markup in a music function
Date: Mon, 10 May 2010 22:22:15 -0700


I'd like to be able to compute the width of a markup inside a music function, so that I can size another element based on the size of the markup.

I've figured out how to compute the size inside a markup command:

(ly:stencil-extent (interpret-markup layout props (markup ...)) X)

This returns a pair of extents, and the difference of the cdr and car is the width.  This works great, but requires one to have the 'layout' and 'props' context, which one does not inside a music function.  Is there some way to combine the two approaches?  Or another way to get the width of a markup?

Some background: I'm working on a piece that includes narration.  This is notated in the score with a full measure rest and some text above the staff.  I need to give the rest enough horizontal space that the text doesn't collide with other objects.  I'm already using \textLengthOn, but this isn't quite enough when there is a rehearsal mark on the barline before or after the narration.  In this case Lilypond frequently places the rehearsal mark above the text, which looks unsightly (see [1] for an example image).  I did try setting the text's outside-staff-priority equal to that of the RehearsalMark (1500), but this doesn't appear to change anything.  My current idea is to add extra space to the rest, using X-extent or some such, so that the bar is a little wider than the text and gives the rehearsal mark space to fall down to its normal height.  However, I'd certainly welcome suggestions for other ways to attack the problem!

Nathan Reed


reply via email to

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