[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting width of markup in a music function
From: |
David Kastrup |
Subject: |
Re: Getting width of markup in a music function |
Date: |
Tue, 11 May 2010 09:01:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Nathan Reed <address@hidden> 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
- Getting width of markup in a music function, Nathan Reed, 2010/05/11
- Re: Getting width of markup in a music function, Mark Polesky, 2010/05/11
- Re: Getting width of markup in a music function, Nathan Reed, 2010/05/11
- Re: Getting width of markup in a music function, Han-Wen Nienhuys, 2010/05/12
- Re: Getting width of markup in a music function, Nathan Reed, 2010/05/17
- Re: Getting width of markup in a music function, Neil Puttock, 2010/05/17
- Re: Getting width of markup in a music function, Nathan Reed, 2010/05/22