Nathan Reed <nathaniel.r...@gmail.com> writes: > Hello, > > 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?
I find in the internals docs: -- Function: ly:text-interface::interpret-markup Convert a text markup into a stencil. Takes three arguments, LAYOUT, PROPS, and MARKUP. LAYOUT is a `\layout' block; it may be obtained from a grob with `ly:grob-layout'. PROPS is an alist chain, i.e. a list of alists. This is typically obtained with `(ly:grob-alist-chain grob (ly:output-def-lookup layout 'text-font-defaults))'. MARKUP is the markup text to be processed. So that should work out if you have a grob already. No idea where you'd get one. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user