lilypond-user
[Top][All Lists]
Advanced

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

Re: Centering a stencil on another stencil


From: Thomas Morley
Subject: Re: Centering a stencil on another stencil
Date: Fri, 7 Aug 2015 20:17:48 +0200

2015-08-07 19:28 GMT+02:00 Paul Morris <address@hidden>:
>> On Jul 27, 2015, at 6:14 PM, Thomas Morley <address@hidden> wrote:
>>
>> We've already ly:stencil-aligned-to and centered-stencil, leading to:
>>
>> circle = #(make-circle-stencil 3 0.4 #f)
>>
>> square =
>> #(stencil-with-color
>>  (make-connected-path-stencil
>>   '((0 0) (3 0) (3 3) (0 3) (0 0))
>>   0.4 1 1 #f #f)
>>  blue)
>>
>> \markup \line {
>>  \stencil #(ly:stencil-add circle square)
>>  "   "
>>  \stencil #(ly:stencil-add circle (ly:stencil-aligned-to square X CENTER))
>>  "   "
>>  \stencil #(ly:stencil-add circle (ly:stencil-aligned-to square Y CENTER))
>>  "   "
>>  \stencil #(ly:stencil-add circle (centered-stencil square))
>> }
>>
>> So I see no advantage in a new LSR-snippet.
>
> Hi Harm,  Just catching up with email after being away myself…
>
> The trouble is that centered-stencil moves the stencil so it is centered on 
> the X,Y point 0,0
>
> from stencil.scm:
>
> (define-public (centered-stencil stencil)
>   "Center stencil @var{stencil} in both the X and Y directions."
>   (ly:stencil-aligned-to (ly:stencil-aligned-to stencil X CENTER) Y CENTER))
>
> But in my actual use case I need the first stencil to stay at its given 
> location, and then center the second stencil on it.  (It is a note head 
> stencil, and I believe moving it to 0,0 will mess up the position of the 
> stem, etc.)  So that’s the reason for the snippet.  It could be made more 
> explicit in comments, description, example, etc.  Let me know what you think.
>
> -Paul



Hi Paul,

welcome back.

May I ask you to provide a code-example where the output is different?
For the given one I can't see any.

Cheers,
  Harm



reply via email to

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