Re: Using path expressions to override stencils

2016-02-17 Thread Paul Booker

> 
> customClefStencilTwo =
> #(make-path-stencil
>   '(rmoveto 0 0
>  rcurveto 0 0.75 1 0.75 1 0
>  rcurveto 0 -0.75 -1 -0.75 -1 0
>  rcurveto -1 0 -1 1.5 -0.5 1.5
>  rmoveto 0.5 -1.5
>  rcurveto -1 0 -1 -1.5 -0.5 -1.5
>  rmoveto 0.5 1.5
>  rmoveto 1 0
>  rcurveto 2.5 0 2.5 4 4 4
>  rmoveto -4 -4
>  rcurveto 2.5 0 2.5 -4 4 -4)
>   0.2 ;; line thickness
>   1 ;; x-axis scaling factor
>   1 ;; y-axis scaling factor
>   #f ;; filled path or not?
>   )
> 
> \markup \stencil #customClefStencilOne
> \markup " "
> \markup " "
> \markup \stencil #customClefStencilTwo
> 

Hi Paul,
I think this is connected to a previous post of yours back in 2013, is it
not? I'm glad it has been absorbed into the mix, because I like the idea of
being able to scale the stencil directly. Thank you for this; I'm now spoilt
for choice!
Yes, it should be in lsr.
Cheers
Paul




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Paul Morris
Hi Paul, 

If you are using 2.19 you might want to use "make-path-stencil” instead.  (It 
is not in 2.18 and so not in the LSR yet. Although maybe we should add it 
commented out?)  It calculates the extents of the stencil for you so you don’t 
have to specify them.  See below.

Cheers,
-Paul


\version "2.19.36"

customClefStencilOne =
#(ly:make-stencil
  `(path 0.2
 `(rmoveto 0 0
rcurveto 0 0.75 1 0.75 1 0
rcurveto 0 -0.75 -1 -0.75 -1 0
rcurveto -1 0 -1 1.5 -0.5 1.5
rmoveto 0.5 -1.5
rcurveto -1 0 -1 -1.5 -0.5 -1.5
rmoveto 0.5 1.5
rmoveto 1 0
rcurveto 2.5 0 2.5 4 4 4
rmoveto -4 -4
rcurveto 2.5 0 2.5 -4 4 -4))
  (cons -0.5 1)
  (cons -3 5))

customClefStencilTwo =
#(make-path-stencil
  '(rmoveto 0 0
 rcurveto 0 0.75 1 0.75 1 0
 rcurveto 0 -0.75 -1 -0.75 -1 0
 rcurveto -1 0 -1 1.5 -0.5 1.5
 rmoveto 0.5 -1.5
 rcurveto -1 0 -1 -1.5 -0.5 -1.5
 rmoveto 0.5 1.5
 rmoveto 1 0
 rcurveto 2.5 0 2.5 4 4 4
 rmoveto -4 -4
 rcurveto 2.5 0 2.5 -4 4 -4)
  0.2 ;; line thickness
  1 ;; x-axis scaling factor
  1 ;; y-axis scaling factor
  #f ;; filled path or not?
  )

\markup \stencil #customClefStencilOne
\markup " "
\markup " "
\markup \stencil #customClefStencilTwo





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Paul Booker

> Done.
> http://lsr.di.unimi.it/LSR/Item?id=623

> Cheers,
>   Harm


That's great,
Thanks Thomas.

Paul



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Thomas Morley
2016-02-16 19:40 GMT+01:00 Paul Booker :
> Paul Morris  paulwmorris.com> writes:
>
>>
>> > On Feb 16, 2016, at 8:35 AM, Paul Booker  homebass.net> wrote:
>> >
>> > I've only narrowed the problem down to the function
>>
>> Hi Paul,  Can you send a full but tiny example that we can run/test with
> LilyPond?  See:
>>
>> http://lilypond.org/tiny-examples.html
>>
>> That will make it easier to see what’s going on.
>>
>> -Paul
>> ___
>
> Thanks Paul
> Good point. I should also offer the full path of the error message:
>
>
> /home/gub/NewGub/gub/target/mingw/src/lilypond-git.sv.gnu.or
> g--lilypond.git-release-unstable/lily/grob-property.cc,
> Line 243
>
> Expression:scm_is_null (value) || scm_is_eq (value, marker)
>
> The tiny example here is taken from LSR 623, and you can uncomment the line
> in the "music" variable which switches between overrides to invoke the error.
> I've included (commented out) the original scaled staves which demonstrate
> the capacity of the function:
>
> \version "2.19.36"
> customClefStencil =
>   #(ly:make-stencil
> `(path 0.1
>   `(moveto 0 0
> curveto 0 1 0.7 2.5 1.5 1.5
> lineto 1.5 -3
> closepath)
>   'round
>   'round
>   #t)
>  (cons 0 1.5)
>  (cons -3 2))
> scaleCustomClefStencil =
> #(lambda (grob)
> (let* ((sz (ly:grob-property grob 'font-size 0.0))
>(mult (magstep sz)))
> (set! (ly:grob-property grob 'stencil)

Here you set the stencil-property.

>   (ly:stencil-scale
> customClefStencil
> mult mult
> music =
> \relative c' {
>   \override Staff.Clef.stencil = \customClefStencil
>   %\override Staff.Clef.stencil = \scaleCustomClefStencil
^^^
Here you try to do it again.
But \scaleCustomClefStencil returns #!!
This will be visible if you look at the output of:

  \override Staff.Clef.stencil =
#(lambda (grob)
  (display (scaleCustomClefStencil grob))
  point-stencil)

>   c1 g1
> }
> \new Staff
> \music
>
> %{
>   <<
> \new Staff \with {
> fontSize = #-3
> \override StaffSymbol.staff-space = #(magstep -3)
> \override StaffSymbol.thickness = #(magstep -3)
> }
> \music
>   \new Staff
>   \music
> \new Staff \with {
> fontSize = #2
> \override StaffSymbol.staff-space = #(magstep 2)
> \override StaffSymbol.thickness = #(magstep 2)
> }
> \music
>   >>
> %}
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Try instead:

scaleCustomClefStencil =
#(lambda (grob)
(let* ((sz (ly:grob-property grob 'font-size 0.0))
   (mult (magstep sz)))
  (ly:stencil-scale
customClefStencil
mult mult)))
music =
\relative c' {
  \override Staff.Clef.stencil = \scaleCustomClefStencil
  c1 g1
}

The LSR-snippet is wrong in this regard.
But 2.18.2 was more lax tolerating such things than new devel-versions.
I'll correct the LSR-snippet.

 Cheers,
   Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Thomas Morley
2016-02-16 21:40 GMT+01:00 Thomas Morley :

> The LSR-snippet is wrong in this regard.
> But 2.18.2 was more lax tolerating such things than new devel-versions.
> I'll correct the LSR-snippet.



Done.
http://lsr.di.unimi.it/LSR/Item?id=623

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Paul Booker
Paul Morris  paulwmorris.com> writes:

> 
> > On Feb 16, 2016, at 8:35 AM, Paul Booker  homebass.net> wrote:
> > 
> > I've only narrowed the problem down to the function
> 
> Hi Paul,  Can you send a full but tiny example that we can run/test with
LilyPond?  See:
> 
> http://lilypond.org/tiny-examples.html
> 
> That will make it easier to see what’s going on.
> 
> -Paul
> ___

Thanks Paul 
Good point. I should also offer the full path of the error message:

  
/home/gub/NewGub/gub/target/mingw/src/lilypond-git.sv.gnu.or
g--lilypond.git-release-unstable/lily/grob-property.cc,
Line 243

Expression:scm_is_null (value) || scm_is_eq (value, marker)

The tiny example here is taken from LSR 623, and you can uncomment the line
in the "music" variable which switches between overrides to invoke the error.
I've included (commented out) the original scaled staves which demonstrate
the capacity of the function:

\version "2.19.36"
customClefStencil = 
  #(ly:make-stencil
`(path 0.1
  `(moveto 0 0
curveto 0 1 0.7 2.5 1.5 1.5
lineto 1.5 -3
closepath)
  'round
  'round
  #t)
 (cons 0 1.5)
 (cons -3 2))
scaleCustomClefStencil =
#(lambda (grob)
(let* ((sz (ly:grob-property grob 'font-size 0.0))
   (mult (magstep sz)))
(set! (ly:grob-property grob 'stencil) 
  (ly:stencil-scale
customClefStencil
mult mult
music =
\relative c' {
  \override Staff.Clef.stencil = \customClefStencil
  %\override Staff.Clef.stencil = \scaleCustomClefStencil
  c1 g1
}
\new Staff 
\music

%{
  <<
\new Staff \with {
fontSize = #-3
\override StaffSymbol.staff-space = #(magstep -3)
\override StaffSymbol.thickness = #(magstep -3)
}
\music
  \new Staff 
  \music
\new Staff \with {
fontSize = #2
\override StaffSymbol.staff-space = #(magstep 2)
\override StaffSymbol.thickness = #(magstep 2)
}
\music
  >>
%}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Using path expressions to override stencils

2016-02-16 Thread Paul Morris
> On Feb 16, 2016, at 8:35 AM, Paul Booker  wrote:
> 
> I've only narrowed the problem down to the function

Hi Paul,  Can you send a full but tiny example that we can run/test with 
LilyPond?  See:

http://lilypond.org/tiny-examples.html

That will make it easier to see what’s going on.

-Paul
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Using path expressions to override stencils

2016-02-16 Thread Paul Booker
Regarding LSR item 623:
http://lsr.di.unimi.it/LSR/Search?q=623

I'm sure I had this working with v2.18.2 but not having any luck with v2.19.36

In Win 8.1 I get an error message:

/lily/grob-property.cc, Line 243

Expression: scm_is_null(value) || scm_is_eq(value, marker)

I've only narrowed the problem down to the function

scaleCustomClefStencilTwo =
#(lambda (grob)
(let* ((sz (ly:grob-property grob 'font-size 0.0))
   (mult (magstep sz)))
(set! (ly:grob-property grob 'stencil) 
  (ly:stencil-scale
customClefStencilTwo
mult mult 




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user