lilypond-devel
[Top][All Lists]
Advanced

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

Re: box widths


From: Carl Sorensen
Subject: Re: box widths
Date: Wed, 27 Oct 2004 17:51:09 -0600

On Wed, 2004-10-27 at 08:36, Werner LEMBERG wrote:
> I have a fundamental problem with the width of lilypond output, and
> which should be fixed before releasing 2.4.  Currently, I use
> 
>   (interval-start (ly:stencil-extent page X))
> 
> but this isn't the right value.  Reason:  Contrary to TeX boxes,
> lilypond's horizontal reference point is not always the left edge of
> the output box:
> 
>                      ^
>                      |
>                 +----+----------+
>                 |    |          |
>                 |    |          |
>             ----+----+----------+--->
>                 |    |          |
>                 +----+----------+
>                      |
>                      |
> 
> We have `height' and `depth' as with TeX boxes, and we have `width'
> and `extension' (to coin this term), where `width' is the amount right
> of the y-axis, and `extension' the left amount (and let's assume that
> `extension' is positive).
> 
> The above scheme code gives `width + extension', but I need `width'
> only.  How can I get that?

(ly:stencil-extent stencil X) returns a pair consisting of (extension .
width).  So the the way to get the total width of the stencil is with a
function like

(define (stencil-span my-stencil my-direction)
"Determine the total size of @var{my-stencil} in direction
@var{my-direction}"
   (let ((my-extent (ly:stencil-extent my-stencil mydirection))
        (+ (car my-extent) (cadr my-extent))))

Carl





reply via email to

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