Re: Outliner markup command

2016-01-17 Thread Paul Morris
Hi Harm,  

> On Jan 15, 2016, at 5:58 PM, Thomas Morley <thomasmorle...@gmail.com> wrote:
> 
> The only way I've found, is to delete all color-settings from the 
> stencil-expr.
> Anyone with a better idea?
> 
> Below you'll find what I did.
> Fixes `stencil-whiteout-outline' by applying newly defined `uncolor-stencil'
> Also adding `outliner'-markup-command

This looks like a good solution to me.  Thanks for looking into it and coming 
up with a fix!  That recursive map function is especially nice.  For the name 
of the markup command, I’d like to suggest \outline since it is more in line 
with the names of other markup commands.  

It might also be good to let the \whiteout markup command respond to color 
property overrides, but that’s a separate issue.  And I suppose it raises the 
question of whether to provide both, which is a matter of how sweet or bitter 
to make the syntax.  For example:

\markup {
\override #'(style . outline)
\override #'(thickness . 3)
\override #`(color . ,red)
\whiteout ''text with red outline"
}

\markup {
  \outline #3 #red "text with red outline"
}

Cheers,
-Paul



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


Re: Outliner markup command

2016-01-16 Thread Pierre Perol-Schneider
Thank you Harm, great work.
Cheers,
Pierre

2016-01-15 23:58 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:

> 2016-01-13 22:14 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:
> > 2016-01-13 16:17 GMT+01:00 Paul Morris <p...@paulwmorris.com>:
> >>> On Jan 12, 2016, at 6:09 PM, Thomas Morley <thomasmorle...@gmail.com>
> wrote:
> >>>
> >>> Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.
> >>>
> >>> Look at:
> >>>
> >>> \markup \stencil
> >>> #(stencil-whiteout-outline
> >>>  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
> >>>  0.5
> >>>  red
> >>>  16
> >>>  1)
> >>>
> >>> \markup \stencil
> >>> #(stencil-whiteout-outline
> >>>  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
> green)
> >>>  0.5
> >>>  red
> >>>  16
> >>>  1)
> >>>
> >>> First one is ok.
> >>> But in the second one the color from the stencil is taken (green) and
> >>> the specified (red) is ignored.
> >>> Will investigate more detailed the upcoming days.
> >>
> >> Huh, that’s odd…  stencil-whiteout-box works as expected (see below),
> so the problem must indeed be in stencil-whiteout-outline.
> >>
> >> -Paul
> >
> > Yep.
> >
> > In this part of the code for stencil-whiteout-outline you try to apply
> > a color to a stencil, which is derived from the original one,
> >
> > (ly:stencil-expr
> >  (stencil-with-color
> >   (radial-plot thickness stil empty-stencil)
> >   color))
> >
> > Though, if this original stencil is colored already, it will fail.
> > See:
> >
> > #(define my-box-stil (make-filled-box-stencil '(-1 . 1) '(-1 . 1)))
> >
> > \markup {
> >   \stencil #my-box-stil
> >   \stencil #(stencil-with-color my-box-stil green)
> >   \stencil #(stencil-with-color (stencil-with-color my-box-stil green)
> red)
> >  }
> >
> > Thinking about it, I came to the conclusion it's desired behaviour.
> > Otherwise the following wouldn't work:
> >
> > \markup \with-color #red { foo \with-color #green bar buzz }
> >
> > So far the reason, now looking forward to make it work anyway.
> >
> >
> > Cheers,
> >   Harm
>
> The only way I've found, is to delete all color-settings from the
> stencil-expr.
> Anyone with a better idea?
>
> Below you'll find what I did.
> Fixes `stencil-whiteout-outline' by applying newly defined
> `uncolor-stencil'
> Also adding `outliner'-markup-command
>
> \version "2.18.2"  %% sic !!
>
> #(define (lists-map function ls)
> "Apply @var{function} to @var{ls} and all of it sublists.
>
> First it recurses over the children, then the function is applied to
> @var{ls}."
> (if (list? ls)
> (set! ls (map (lambda (y) (lists-map function y)) ls))
> ls)
> (function ls))
>
> #(define (uncolor-stencil stil)
> "Delete colors from stencil @var{stil}"
>   (let* ((x-ext (ly:stencil-extent stil X))
>  (y-ext (ly:stencil-extent stil Y))
>  (stil-expr (ly:stencil-expr stil))
>  (get-caddr-if-condition
>(lambda (e)
>  (if (and (list? e) (member 'color e))
>  ;; the stencil-expr of a colored stencil is of type
>  ;; (list 'color (list r g b) (list rest-of-stencil-expr))
>  ;; Thus we can be sure that (caddr e) is valid
>  ;; Even for an empty-stencil it evaluates to '()
>  (caddr e)
>  e
>  (ly:make-stencil
>(lists-map get-caddr-if-condition stil-expr)
>x-ext
>y-ext)))
>
> #(define*-public (stencil-whiteout-outline
>  stil #:optional (thickness 0.3) (color white)
>  (angle-increments 16) (radial-increments 1))
>   "This function works by creating a series of white or @var{color}
> stencils radially offset from the original stencil with angles from
> 0 to 2*pi, at an increment of @code{angle-inc}, and with radii
> from @code{radial-inc} to @var{thickness}.  @var{thickness} is how big
> the white outline is, as a multiple of line-thickness.
> @var{radial-increments} is how many copies of the white stencil we make
> on our way out to thickness.  @var{angle-increments} is how many copies
> of the white stencil we make between 0 and 2*pi.&q

Re: Outliner markup command

2016-01-16 Thread Pierre Perol-Schneider
Added to the LSR: http://lsr.di.unimi.it/LSR/Item?id=1016
Cheers,
Pierre

2016-01-16 11:26 GMT+01:00 Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com>:

> Thank you Harm, great work.
> Cheers,
> Pierre
>
> 2016-01-15 23:58 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:
>
>> 2016-01-13 22:14 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:
>> > 2016-01-13 16:17 GMT+01:00 Paul Morris <p...@paulwmorris.com>:
>> >>> On Jan 12, 2016, at 6:09 PM, Thomas Morley <thomasmorle...@gmail.com>
>> wrote:
>> >>>
>> >>> Though, there might be a bug in `stencil-whiteout-outline', Paul
>> cc-ed.
>> >>>
>> >>> Look at:
>> >>>
>> >>> \markup \stencil
>> >>> #(stencil-whiteout-outline
>> >>>  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
>> >>>  0.5
>> >>>  red
>> >>>  16
>> >>>  1)
>> >>>
>> >>> \markup \stencil
>> >>> #(stencil-whiteout-outline
>> >>>  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
>> green)
>> >>>  0.5
>> >>>  red
>> >>>  16
>> >>>  1)
>> >>>
>> >>> First one is ok.
>> >>> But in the second one the color from the stencil is taken (green) and
>> >>> the specified (red) is ignored.
>> >>> Will investigate more detailed the upcoming days.
>> >>
>> >> Huh, that’s odd…  stencil-whiteout-box works as expected (see below),
>> so the problem must indeed be in stencil-whiteout-outline.
>> >>
>> >> -Paul
>> >
>> > Yep.
>> >
>> > In this part of the code for stencil-whiteout-outline you try to apply
>> > a color to a stencil, which is derived from the original one,
>> >
>> > (ly:stencil-expr
>> >  (stencil-with-color
>> >   (radial-plot thickness stil empty-stencil)
>> >   color))
>> >
>> > Though, if this original stencil is colored already, it will fail.
>> > See:
>> >
>> > #(define my-box-stil (make-filled-box-stencil '(-1 . 1) '(-1 . 1)))
>> >
>> > \markup {
>> >   \stencil #my-box-stil
>> >   \stencil #(stencil-with-color my-box-stil green)
>> >   \stencil #(stencil-with-color (stencil-with-color my-box-stil green)
>> red)
>> >  }
>> >
>> > Thinking about it, I came to the conclusion it's desired behaviour.
>> > Otherwise the following wouldn't work:
>> >
>> > \markup \with-color #red { foo \with-color #green bar buzz }
>> >
>> > So far the reason, now looking forward to make it work anyway.
>> >
>> >
>> > Cheers,
>> >   Harm
>>
>> The only way I've found, is to delete all color-settings from the
>> stencil-expr.
>> Anyone with a better idea?
>>
>> Below you'll find what I did.
>> Fixes `stencil-whiteout-outline' by applying newly defined
>> `uncolor-stencil'
>> Also adding `outliner'-markup-command
>>
>> \version "2.18.2"  %% sic !!
>>
>> #(define (lists-map function ls)
>> "Apply @var{function} to @var{ls} and all of it sublists.
>>
>> First it recurses over the children, then the function is applied to
>> @var{ls}."
>> (if (list? ls)
>> (set! ls (map (lambda (y) (lists-map function y)) ls))
>> ls)
>> (function ls))
>>
>> #(define (uncolor-stencil stil)
>> "Delete colors from stencil @var{stil}"
>>   (let* ((x-ext (ly:stencil-extent stil X))
>>  (y-ext (ly:stencil-extent stil Y))
>>  (stil-expr (ly:stencil-expr stil))
>>  (get-caddr-if-condition
>>(lambda (e)
>>  (if (and (list? e) (member 'color e))
>>  ;; the stencil-expr of a colored stencil is of type
>>  ;; (list 'color (list r g b) (list rest-of-stencil-expr))
>>  ;; Thus we can be sure that (caddr e) is valid
>>  ;; Even for an empty-stencil it evaluates to '()
>>  (caddr e)
>>  e
>>  (ly:make-stencil
>>(lists-map get-caddr-if-condition stil-expr)
>>x-ext
>>y-ext)))
>>
>> #(define*-public (stencil-whiteout-outline
>>  stil #:optional (thickness 0.3) (

Re: Outliner markup command

2016-01-15 Thread Thomas Morley
2016-01-13 22:14 GMT+01:00 Thomas Morley <thomasmorle...@gmail.com>:
> 2016-01-13 16:17 GMT+01:00 Paul Morris <p...@paulwmorris.com>:
>>> On Jan 12, 2016, at 6:09 PM, Thomas Morley <thomasmorle...@gmail.com> wrote:
>>>
>>> Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.
>>>
>>> Look at:
>>>
>>> \markup \stencil
>>> #(stencil-whiteout-outline
>>>  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
>>>  0.5
>>>  red
>>>  16
>>>  1)
>>>
>>> \markup \stencil
>>> #(stencil-whiteout-outline
>>>  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
>>>  0.5
>>>  red
>>>  16
>>>  1)
>>>
>>> First one is ok.
>>> But in the second one the color from the stencil is taken (green) and
>>> the specified (red) is ignored.
>>> Will investigate more detailed the upcoming days.
>>
>> Huh, that’s odd…  stencil-whiteout-box works as expected (see below), so the 
>> problem must indeed be in stencil-whiteout-outline.
>>
>> -Paul
>
> Yep.
>
> In this part of the code for stencil-whiteout-outline you try to apply
> a color to a stencil, which is derived from the original one,
>
> (ly:stencil-expr
>  (stencil-with-color
>   (radial-plot thickness stil empty-stencil)
>   color))
>
> Though, if this original stencil is colored already, it will fail.
> See:
>
> #(define my-box-stil (make-filled-box-stencil '(-1 . 1) '(-1 . 1)))
>
> \markup {
>   \stencil #my-box-stil
>   \stencil #(stencil-with-color my-box-stil green)
>   \stencil #(stencil-with-color (stencil-with-color my-box-stil green) red)
>  }
>
> Thinking about it, I came to the conclusion it's desired behaviour.
> Otherwise the following wouldn't work:
>
> \markup \with-color #red { foo \with-color #green bar buzz }
>
> So far the reason, now looking forward to make it work anyway.
>
>
> Cheers,
>   Harm

The only way I've found, is to delete all color-settings from the stencil-expr.
Anyone with a better idea?

Below you'll find what I did.
Fixes `stencil-whiteout-outline' by applying newly defined `uncolor-stencil'
Also adding `outliner'-markup-command

\version "2.18.2"  %% sic !!

#(define (lists-map function ls)
"Apply @var{function} to @var{ls} and all of it sublists.

First it recurses over the children, then the function is applied to
@var{ls}."
(if (list? ls)
(set! ls (map (lambda (y) (lists-map function y)) ls))
ls)
(function ls))

#(define (uncolor-stencil stil)
"Delete colors from stencil @var{stil}"
  (let* ((x-ext (ly:stencil-extent stil X))
 (y-ext (ly:stencil-extent stil Y))
 (stil-expr (ly:stencil-expr stil))
 (get-caddr-if-condition
   (lambda (e)
 (if (and (list? e) (member 'color e))
 ;; the stencil-expr of a colored stencil is of type
 ;; (list 'color (list r g b) (list rest-of-stencil-expr))
 ;; Thus we can be sure that (caddr e) is valid
 ;; Even for an empty-stencil it evaluates to '()
 (caddr e)
 e
 (ly:make-stencil
   (lists-map get-caddr-if-condition stil-expr)
   x-ext
   y-ext)))

#(define*-public (stencil-whiteout-outline
 stil #:optional (thickness 0.3) (color white)
 (angle-increments 16) (radial-increments 1))
  "This function works by creating a series of white or @var{color}
stencils radially offset from the original stencil with angles from
0 to 2*pi, at an increment of @code{angle-inc}, and with radii
from @code{radial-inc} to @var{thickness}.  @var{thickness} is how big
the white outline is, as a multiple of line-thickness.
@var{radial-increments} is how many copies of the white stencil we make
on our way out to thickness.  @var{angle-increments} is how many copies
of the white stencil we make between 0 and 2*pi."
  (if (or (not (positive? angle-increments))
  (not (positive? radial-increments)))
  (begin
   (ly:warning "Both angle-increments and radial-increments must
be positive numbers.")
   stil)
  (let* ((2pi 6.283185307)
 (angle-inc (/ 2pi angle-increments))
 (radial-inc (/ thickness radial-increments)))

(define (circle-plot ang dec radius original-stil new-stil)
  ;; ang (angle) and dec (decrement) are in radians, not degrees
  (if (<= ang 0)
  new-stil
  (circle-plot (- ang dec) dec radius original-stil
(ly:stencil-add
 new-stil
 (ly:sten

Re: Outliner markup command

2016-01-13 Thread Pierre Perol-Schneider
Hi Harm,

2016-01-13 0:09 GMT+01:00 Thomas Morley :


> You can't hope a markup-command will accept an override for a
> property, if said property isn't declared in any way.
>

Well, I thought it *was *declared since the code description says :
"This function works by creating a series of white or @var{color}
stencils"

Anyway, I'm far from fully understanding Paul's (?) coding.

...
> First one is ok.
> But in the second one the color from the stencil is taken (green) and
> the specified (red) is ignored.
> Will investigate more detailed the upcoming days.
>

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


Re: Outliner markup command

2016-01-13 Thread Pierre Perol-Schneider
OK thanks David.

2016-01-13 13:45 GMT+01:00 David Kastrup :

> Pierre Perol-Schneider  writes:
>
> > Hi David,
> >
> > 2016-01-12 23:52 GMT+01:00 David Kastrup :
> >
> >
> >> \override #`(color . ,red)
> >>
> >> And yes, I use a backward tick here.  The forward tick will not
> >> cooperate with the comma later.
> >>
> >
> > I'm not sure to clearly understand what I can do here but i'll
> > investigate anyhow.
>
> This is the correct version of the \override #'(color . red) you wrote
> which does not work.  Whether the above works depends on whether the
> following markup actually uses the color property, of course.  But your
> version would not have worked with any command.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Outliner markup command

2016-01-13 Thread Pierre Perol-Schneider
Hi David,

2016-01-12 23:52 GMT+01:00 David Kastrup :


> \override #`(color . ,red)
>
> And yes, I use a backward tick here.  The forward tick will not
> cooperate with the comma later.
>

I'm not sure to clearly understand what I can do here but i'll investigate
anyhow.
Thanks for the tip.
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Outliner markup command

2016-01-13 Thread David Kastrup
Pierre Perol-Schneider  writes:

> Hi David,
>
> 2016-01-12 23:52 GMT+01:00 David Kastrup :
>
>
>> \override #`(color . ,red)
>>
>> And yes, I use a backward tick here.  The forward tick will not
>> cooperate with the comma later.
>>
>
> I'm not sure to clearly understand what I can do here but i'll
> investigate anyhow.

This is the correct version of the \override #'(color . red) you wrote
which does not work.  Whether the above works depends on whether the
following markup actually uses the color property, of course.  But your
version would not have worked with any command.

-- 
David Kastrup

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


Re: Outliner markup command

2016-01-13 Thread Thomas Morley
2016-01-13 16:17 GMT+01:00 Paul Morris :
>> On Jan 12, 2016, at 6:09 PM, Thomas Morley  wrote:
>>
>> Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.
>>
>> Look at:
>>
>> \markup \stencil
>> #(stencil-whiteout-outline
>>  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
>>  0.5
>>  red
>>  16
>>  1)
>>
>> \markup \stencil
>> #(stencil-whiteout-outline
>>  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
>>  0.5
>>  red
>>  16
>>  1)
>>
>> First one is ok.
>> But in the second one the color from the stencil is taken (green) and
>> the specified (red) is ignored.
>> Will investigate more detailed the upcoming days.
>
> Huh, that’s odd…  stencil-whiteout-box works as expected (see below), so the 
> problem must indeed be in stencil-whiteout-outline.
>
> -Paul

Yep.

In this part of the code for stencil-whiteout-outline you try to apply
a color to a stencil, which is derived from the original one,

(ly:stencil-expr
 (stencil-with-color
  (radial-plot thickness stil empty-stencil)
  color))

Though, if this original stencil is colored already, it will fail.
See:

#(define my-box-stil (make-filled-box-stencil '(-1 . 1) '(-1 . 1)))

\markup {
  \stencil #my-box-stil
  \stencil #(stencil-with-color my-box-stil green)
  \stencil #(stencil-with-color (stencil-with-color my-box-stil green) red)
 }

Thinking about it, I came to the conclusion it's desired behaviour.
Otherwise the following wouldn't work:

\markup \with-color #red { foo \with-color #green bar buzz }

So far the reason, now looking forward to make it work anyway.


Cheers,
  Harm

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


Re: Outliner markup command

2016-01-13 Thread Simon Albrecht

On 13.01.2016 13:24, Pierre Perol-Schneider wrote:

Hi David,

2016-01-12 23:52 GMT+01:00 David Kastrup >:


\override #`(color . ,red)

And yes, I use a backward tick here.  The forward tick will not
cooperate with the comma later.


I'm not sure to clearly understand


A little background info: The ` and , are abbreviations, spelt out the 
above example reads \override #(quasiquote (color . (unquote red))). 
Quoting (i.e. '()) means that an expression is not evaluated; 
quasi-quoting means that an expression is not evaluated except for those 
parts which are unquoted explicitly. #red needs to be evaluated to a 
color, so you need to unquote it, and use a quasi-quotation instead of a 
quotation.


HTH, Simon

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


Re: Outliner markup command

2016-01-13 Thread Pierre Perol-Schneider
Thank you Simon for this clear explanation.
Pierre

2016-01-13 20:17 GMT+01:00 Simon Albrecht :

> On 13.01.2016 13:24, Pierre Perol-Schneider wrote:
>
>> Hi David,
>>
>> 2016-01-12 23:52 GMT+01:00 David Kastrup > >>:
>>
>> \override #`(color . ,red)
>>
>> And yes, I use a backward tick here.  The forward tick will not
>> cooperate with the comma later.
>>
>>
>> I'm not sure to clearly understand
>>
>
> A little background info: The ` and , are abbreviations, spelt out the
> above example reads \override #(quasiquote (color . (unquote red))).
> Quoting (i.e. '()) means that an expression is not evaluated; quasi-quoting
> means that an expression is not evaluated except for those parts which are
> unquoted explicitly. #red needs to be evaluated to a color, so you need to
> unquote it, and use a quasi-quotation instead of a quotation.
>
> HTH, Simon
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Outliner markup command

2016-01-13 Thread Paul Morris
> On Jan 13, 2016, at 7:45 AM, David Kastrup  wrote:
> 
> This is the correct version of the \override #'(color . red) you wrote
> which does not work.  Whether the above works depends on whether the
> following markup actually uses the color property, of course.

Indeed, the “\whiteout" markup command does not currently use the color 
property (although the functions it calls does, “stencil-whiteout” etc.).  No 
reason it couldn’t be enhanced to use it though.

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


Re: Outliner markup command

2016-01-13 Thread Paul Morris
> On Jan 12, 2016, at 6:09 PM, Thomas Morley  wrote:
> 
> Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.
> 
> Look at:
> 
> \markup \stencil
> #(stencil-whiteout-outline
>  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
>  0.5
>  red
>  16
>  1)
> 
> \markup \stencil
> #(stencil-whiteout-outline
>  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
>  0.5
>  red
>  16
>  1)
> 
> First one is ok.
> But in the second one the color from the stencil is taken (green) and
> the specified (red) is ignored.
> Will investigate more detailed the upcoming days.

Huh, that’s odd…  stencil-whiteout-box works as expected (see below), so the 
problem must indeed be in stencil-whiteout-outline.

-Paul


\markup \stencil
#(stencil-whiteout-box
 (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
 0.5
 1
 red)

\markup \stencil
#(stencil-whiteout-box
 (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
 0.5
 1
 red)



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


Re: Outliner markup command

2016-01-12 Thread Simon Albrecht

On 12.01.2016 15:37, Pierre Perol-Schneider wrote:


\header {
  title = \markup\outliner #3 #'"orange" #'"yellow" { Some Music }
}


Nice idea! You needn’t quote the strings, and #"orange" is at least a 
little less convoluted.


Yours, Simon

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


Re: Outliner markup command

2016-01-12 Thread David Kastrup
David Kastrup  writes:

> Thomas Morley  writes:
>
>> Any chance to directly insert the result of a scheme-function in a
>> newly created markup?
>
> I've just written a syntax rule allowing that, with the arguments of the
> scheme function being scanned in \notemode.  Which is what they are
> usually scanned in.  That's required for scheme functions with music
> arguments.  However, it means that any markup arguments of the scheme
> function (apart from straightforward strings) need to be introduced
> using \markup ...
>
> I'm not sure whether we even should switch modes here.  Maybe leave it
> to the responsibility of the user to invoke \notemode ?  But \notemode
> does not accept anything but <<... >> or {...} so the kind of music
> arguments you can enter in that manner is fairly restricted.  Hm, but
> one can always escape to ##{...#} to get \notemode.
>
> So... \notemode or \markup mode?  And who writes up the docs and
> explains either complication?
>
> Current scheme functions with a music argument are:
> \beamExceptions
> \settingsFrom (oh, we have that one still?)
> \stringTuning
>
> Likely not all that important yet...

Ok, I think I've decided: parsing function arguments in notemode means
that tokens may not be absorbed into the function argument list after
they have already been scanned in notemode.  Stuff like `a' becomes a
note following the function call rather than a word markup when it has
been used as lookahead token.  That won't do.  For better or worse, I
have to stick with markup mode.

But function argument lists will still be parsed with the argument list
parser used for notemode.  I'm not really sure its choices will always
be correct.

-- 
David Kastrup

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


Re: Outliner markup command

2016-01-12 Thread Pierre Perol-Schneider
Hi Harm,

2016-01-12 21:24 GMT+01:00 Thomas Morley :


> I've always found it a little so-so, to define custom markup-commands
> only combining a personal choice of preexisting markup-commands.
>

I fully agree, it's just that my scheme knowledge is also a little so-so ;)
Actually I tried to. Without success.
Basically the idea was to make the 'whiteout' command to accept a color
override. E.g. :

\version "2.19.35"

\markup {
  \combine
\filled-box #'(-1 . 18) #'(-3 . 4) #1
\override #'(style . outline)
\override #'(thickness . 3)

%% here :
\override #'(color . red)
\whiteout

%% here the color affects the whiteout (unwanted)
\with-color #blue
"whiteout-outline"
}

... but I'll keep working on it ;)..
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Outliner markup command

2016-01-12 Thread Pierre Perol-Schneider
2016-01-12 21:35 GMT+01:00 Thomas Morley :


> You can already put it into LSR: comment out the code, let a
> dummy-markup displayed and add [needs LSR upgrade] to the title. It
> will then be stored in the unapproved snippets, not searchable,
> though.
>

Yep that was my intention as soon as I'll be happy with the coding.


>
> Or you can c/p all needed defs into the snippet to make it work with
> 2.18.2. In this case please comment thoroughly that those defs can be
> deleted next LSR-upgrade.
>

Hum, I'm afraid not, that leads me the the previous point (my Scheme
knowledge...)

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


Re: Outliner markup command

2016-01-12 Thread Pierre Perol-Schneider
Hi Simon,

2016-01-12 20:46 GMT+01:00 Simon Albrecht :


> Nice idea! You needn’t quote the strings, and #"orange" is at least a
> little less convoluted.
>

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


Re: Outliner markup command

2016-01-12 Thread David Kastrup
Thomas Morley  writes:

> Any chance to directly insert the result of a scheme-function in a
> newly created markup?

Tracker issue: 4741 (https://sourceforge.net/p/testlilyissues/issues/4741/)
Rietveld issue: 285070043 (https://codereview.appspot.com/285070043)
Issue description:
  Allow Scheme functions to be called inside of markup

I suggest that you try creating regtests for it and figure out whether
the behavior inside of \markup is satisfactorily consistent for
different argument types.  I'm somewhat queasy about that and you are
pretty thorough.  And of course you know just what you actually want
that for, so it would be important to check that it delivers.

-- 
David Kastrup

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


Re: Outliner markup command

2016-01-12 Thread Thomas Morley
2016-01-12 22:08 GMT+01:00 David Kastrup :
> Thomas Morley  writes:
>
>> 2016-01-12 15:37 GMT+01:00 Pierre Perol-Schneider
>> :
>>
>> I've always found it a little so-so, to define custom markup-commands
>> only combining a personal choice of preexisting markup-commands.
>> Wouldn't it be better to let it do by a scheme-function?
>> Though, you can't further reuse it in another markup like:
>>
>> \version "2.19.36"
>>
>> foo = #(define-scheme-function ()() #{ \markup "bla" #})
>> \markup \line { "xy" \foo }
>>
>> Returns an error.
>> You would need to make some detour:
>>
>> %% Two possebilities to get the _result_ of `foo'
>> buzz = \foo
>> \markup \line { "xy" \buzz }
>>
>> \markup \line { "xy" ##{ \foo #} }
>>
>> Any chance to directly insert the result of a scheme-function in a
>> newly created markup?
>
> I've just written a syntax rule allowing that, with the arguments of the
> scheme function being scanned in \notemode.  Which is what they are
> usually scanned in.  That's required for scheme functions with music
> arguments.  However, it means that any markup arguments of the scheme
> function (apart from straightforward strings) need to be introduced
> using \markup ...
>
> I'm not sure whether we even should switch modes here.  Maybe leave it
> to the responsibility of the user to invoke \notemode ?  But \notemode
> does not accept anything but <<... >> or {...} so the kind of music
> arguments you can enter in that manner is fairly restricted.  Hm, but
> one can always escape to ##{...#} to get \notemode.
>
> So... \notemode or \markup mode?  And who writes up the docs and
> explains either complication?

Wow, that was fast.

I think \notemode or \markup mode? is decided by your follow-up mail(s).

It was my request, so I'll do docs and regtests. Most likely I'll not
be able to start on it before next weekend, though.
Same for further guile2-stuff
Too busy in my regular job ...

Cheers,
  Harm

>
> Current scheme functions with a music argument are:
> \beamExceptions
> \settingsFrom (oh, we have that one still?)
> \stringTuning
>
> Likely not all that important yet...
>
> --
> David Kastrup

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


Re: Outliner markup command

2016-01-12 Thread Thomas Morley
2016-01-12 15:37 GMT+01:00 Pierre Perol-Schneider
:
> Hi,
>
> Yesterday night I thought about rewriting this snippet:
> http://lsr.di.unimi.it/LSR/Item?id=890 using the new whiteout 'outline'
> override and finally discovered a funny side effect:
>
> \version "2.19.35"
> #(set-default-paper-size "a6")
>
> #(define-markup-command (outliner layout props outln-width outln-clr
> text-clr text)
>   (number? string? string? markup?)
>   "Draw a colored ouline around a colored text."
>   (interpret-markup layout props
> (markup
>   (#:combine
>(#:override
> (cons 'style 'outline)
> (#:override
>  (cons 'thickness outln-width)
>  (#:whiteout
>   (#:with-color
>(x11-color outln-clr)
>text
>(#:with-color
> (x11-color text-clr)
> text)



I've always found it a little so-so, to define custom markup-commands
only combining a personal choice of preexisting markup-commands.
Wouldn't it be better to let it do by a scheme-function?
Though, you can't further reuse it in another markup like:

\version "2.19.36"

foo = #(define-scheme-function ()() #{ \markup "bla" #})
\markup \line { "xy" \foo }

Returns an error.
You would need to make some detour:

%% Two possebilities to get the _result_ of `foo'
buzz = \foo
\markup \line { "xy" \buzz }

\markup \line { "xy" ##{ \foo #} }

Any chance to directly insert the result of a scheme-function in a
newly created markup?
(David cc-ed)


Thanks,
  Harm

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


Re: Outliner markup command

2016-01-12 Thread Thomas Morley
2016-01-12 18:40 GMT+01:00 Pierre Perol-Schneider
:
> Hi Trevor,
>
> Thank you.
> Yes, I'll add a snippet for sure, as soon as LSR will work with v2.20.
>
> Pierre
>
> 2016-01-12 16:42 GMT+01:00 Trevor Daniels :
>>
>> Hi Pierre
>>
>> Very nice!  Ideal for those more light-hearted musical items.
>>
>> LSR?
>>
>> Trevor



You can already put it into LSR: comment out the code, let a
dummy-markup displayed and add [needs LSR upgrade] to the title. It
will then be stored in the unapproved snippets, not searchable,
though.

Or you can c/p all needed defs into the snippet to make it work with
2.18.2. In this case please comment thoroughly that those defs can be
deleted next LSR-upgrade.

Cheers,
  Harm

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


Re: Outliner markup command

2016-01-12 Thread David Kastrup
Thomas Morley  writes:

> 2016-01-12 15:37 GMT+01:00 Pierre Perol-Schneider
> :
>
> I've always found it a little so-so, to define custom markup-commands
> only combining a personal choice of preexisting markup-commands.
> Wouldn't it be better to let it do by a scheme-function?
> Though, you can't further reuse it in another markup like:
>
> \version "2.19.36"
>
> foo = #(define-scheme-function ()() #{ \markup "bla" #})
> \markup \line { "xy" \foo }
>
> Returns an error.
> You would need to make some detour:
>
> %% Two possebilities to get the _result_ of `foo'
> buzz = \foo
> \markup \line { "xy" \buzz }
>
> \markup \line { "xy" ##{ \foo #} }
>
> Any chance to directly insert the result of a scheme-function in a
> newly created markup?

I've just written a syntax rule allowing that, with the arguments of the
scheme function being scanned in \notemode.  Which is what they are
usually scanned in.  That's required for scheme functions with music
arguments.  However, it means that any markup arguments of the scheme
function (apart from straightforward strings) need to be introduced
using \markup ...

I'm not sure whether we even should switch modes here.  Maybe leave it
to the responsibility of the user to invoke \notemode ?  But \notemode
does not accept anything but <<... >> or {...} so the kind of music
arguments you can enter in that manner is fairly restricted.  Hm, but
one can always escape to ##{...#} to get \notemode.

So... \notemode or \markup mode?  And who writes up the docs and
explains either complication?

Current scheme functions with a music argument are:
\beamExceptions
\settingsFrom (oh, we have that one still?)
\stringTuning

Likely not all that important yet...

-- 
David Kastrup

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


Outliner markup command

2016-01-12 Thread Pierre Perol-Schneider
Hi,

Yesterday night I thought about rewriting this snippet:
http://lsr.di.unimi.it/LSR/Item?id=890 using the new whiteout 'outline'
override and finally discovered a funny side effect:

\version "2.19.35"
#(set-default-paper-size "a6")

#(define-markup-command (outliner layout props outln-width outln-clr
text-clr text)
  (number? string? string? markup?)
  "Draw a colored ouline around a colored text."
  (interpret-markup layout props
(markup
  (#:combine
   (#:override
(cons 'style 'outline)
(#:override
 (cons 'thickness outln-width)
 (#:whiteout
  (#:with-color
   (x11-color outln-clr)
   text
   (#:with-color
(x11-color text-clr)
text)

%% Example:
some-music = \score {
  \relative {
\tempo "Allegro"
c'_( d e f g a b c)
\bar "|."
  }
  \layout { indent = 0 }
}

\header {
  title = \markup\outliner #3 #'"orange" #'"yellow" { Some Music }
}
\some-music

\markup
\override #'(baseline-skip . 7)
\left-column {
  "A funny output:"
  \outliner #1.3 #'"black" #'"white"
  \score { \some-music }
}

'Hope you'll like it!

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


Re: Outliner markup command

2016-01-12 Thread Trevor Daniels
Hi Pierre

Very nice!  Ideal for those more light-hearted musical items.

LSR?

Trevor

  - Original Message - 
  From: Pierre Perol-Schneider 
  To: lilypond-user 
  Sent: Tuesday, January 12, 2016 2:37 PM
  Subject: Outliner markup command


  Hi,


  Yesterday night I thought about rewriting this snippet: 
http://lsr.di.unimi.it/LSR/Item?id=890 using the new whiteout 'outline' 
override and finally discovered a funny side effect:

  \version "2.19.35"
  #(set-default-paper-size "a6")

  #(define-markup-command (outliner layout props outln-width outln-clr text-clr 
text) 
(number? string? string? markup?)
"Draw a colored ouline around a colored text."
(interpret-markup layout props
  (markup
(#:combine
 (#:override
  (cons 'style 'outline)
  (#:override
   (cons 'thickness outln-width)
   (#:whiteout
(#:with-color
 (x11-color outln-clr)
 text
 (#:with-color
  (x11-color text-clr)
  text)

  %% Example:
  some-music = \score {
\relative { 
  \tempo "Allegro"
  c'_( d e f g a b c)
  \bar "|."
}
\layout { indent = 0 }
  }

  \header {
title = \markup\outliner #3 #'"orange" #'"yellow" { Some Music }
  }
  \some-music

  \markup
  \override #'(baseline-skip . 7)
  \left-column {
"A funny output:"
\outliner #1.3 #'"black" #'"white" 
\score { \some-music }
  }


  'Hope you'll like it!


  Cheers,

  ~Pierre



--


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


Re: Outliner markup command

2016-01-12 Thread David Kastrup
Pierre Perol-Schneider  writes:

> Hi Harm,
>
> 2016-01-12 21:24 GMT+01:00 Thomas Morley :
>
>
>> I've always found it a little so-so, to define custom markup-commands
>> only combining a personal choice of preexisting markup-commands.
>>
>
> I fully agree, it's just that my scheme knowledge is also a little so-so ;)
> Actually I tried to. Without success.
> Basically the idea was to make the 'whiteout' command to accept a color
> override. E.g. :
>
> \version "2.19.35"
>
> \markup {
>   \combine
> \filled-box #'(-1 . 18) #'(-3 . 4) #1
> \override #'(style . outline)
> \override #'(thickness . 3)
>
> %% here :
> \override #'(color . red)

\override #`(color . ,red)

And yes, I use a backward tick here.  The forward tick will not
cooperate with the comma later.

-- 
David Kastrup

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


Re: Outliner markup command

2016-01-12 Thread David Kastrup
Thomas Morley  writes:

> Wow, that was fast.

The change was trivial.  It's the ramifications that aren't.  That's why
I would rather leave them to you.  There will be odd cases rather
certainly.  The question is whether the overall behavior appears
sensible and that's probably easier to judge empirically rather than
deductively.  And I'm not really all that good in cooking up "typical"
test cases.

> It was my request, so I'll do docs and regtests. Most likely I'll not
> be able to start on it before next weekend, though.

If it's ok for your workflow, I'll keep the issue out of staging/master
till your verdict about it is in.

> Same for further guile2-stuff
> Too busy in my regular job ...

Sure.

-- 
David Kastrup

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


Re: Outliner markup command

2016-01-12 Thread Thomas Morley
2016-01-12 23:05 GMT+01:00 Pierre Perol-Schneider
:
> Hi Harm,
>
> 2016-01-12 21:24 GMT+01:00 Thomas Morley :
>
>>
>> I've always found it a little so-so, to define custom markup-commands
>> only combining a personal choice of preexisting markup-commands.
>
>
> I fully agree, it's just that my scheme knowledge is also a little so-so ;)
> Actually I tried to. Without success.
> Basically the idea was to make the 'whiteout' command to accept a color
> override. E.g. :
>
> \version "2.19.35"
>
> \markup {
>   \combine
> \filled-box #'(-1 . 18) #'(-3 . 4) #1
> \override #'(style . outline)
> \override #'(thickness . 3)
>
> %% here :
> \override #'(color . red)

You can't hope a markup-command will accept an override for a
property, if said property isn't declared in any way.
Thus, I tried to write a markup-command aiming exactly this use-case.
Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.

Look at:

\markup \stencil
#(stencil-whiteout-outline
  (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
  0.5
  red
  16
  1)

\markup \stencil
#(stencil-whiteout-outline
  (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
  0.5
  red
  16
  1)

First one is ok.
But in the second one the color from the stencil is taken (green) and
the specified (red) is ignored.
Will investigate more detailed the upcoming days.


Cheers,
  Harm

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


Re: Outliner markup command

2016-01-12 Thread Simon Albrecht

On 13.01.2016 00:09, Thomas Morley wrote:

Though, there might be a bug in `stencil-whiteout-outline', Paul cc-ed.


Here you are.



Look at:

\markup \stencil
#(stencil-whiteout-outline
   (make-filled-box-stencil '(-1 . 1) '(-1 . 1))
   0.5
   red
   16
   1)

\markup \stencil
#(stencil-whiteout-outline
   (stencil-with-color (make-filled-box-stencil '(-1 . 1) '(-1 . 1)) green)
   0.5
   red
   16
   1)

First one is ok.
But in the second one the color from the stencil is taken (green) and
the specified (red) is ignored.



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


Re: Outliner markup command

2016-01-12 Thread Pierre Perol-Schneider
Hi Trevor,

Thank you.
Yes, I'll add a snippet for sure, as soon as LSR will work with v2.20.

Pierre

2016-01-12 16:42 GMT+01:00 Trevor Daniels <t.dani...@treda.co.uk>:

> Hi Pierre
>
> Very nice!  Ideal for those more light-hearted musical items.
>
> LSR?
>
> Trevor
>
>
> - Original Message -
> *From:* Pierre Perol-Schneider <pierre.schneider.pa...@gmail.com>
> *To:* lilypond-user <lilypond-user@gnu.org>
> *Sent:* Tuesday, January 12, 2016 2:37 PM
> *Subject:* Outliner markup command
>
> Hi,
>
> Yesterday night I thought about rewriting this snippet:
> http://lsr.di.unimi.it/LSR/Item?id=890 using the new whiteout 'outline'
> override and finally discovered a funny side effect:
>
> \version "2.19.35"
> #(set-default-paper-size "a6")
>
> #(define-markup-command (outliner layout props outln-width outln-clr
> text-clr text)
>   (number? string? string? markup?)
>   "Draw a colored ouline around a colored text."
>   (interpret-markup layout props
> (markup
>   (#:combine
>(#:override
> (cons 'style 'outline)
> (#:override
>  (cons 'thickness outln-width)
>  (#:whiteout
>   (#:with-color
>(x11-color outln-clr)
>text
>(#:with-color
> (x11-color text-clr)
> text)
>
> %% Example:
> some-music = \score {
>   \relative {
> \tempo "Allegro"
> c'_( d e f g a b c)
> \bar "|."
>   }
>   \layout { indent = 0 }
> }
>
> \header {
>   title = \markup\outliner #3 #'"orange" #'"yellow" { Some Music }
> }
> \some-music
>
> \markup
> \override #'(baseline-skip . 7)
> \left-column {
>   "A funny output:"
>   \outliner #1.3 #'"black" #'"white"
>   \score { \some-music }
> }
>
> 'Hope you'll like it!
>
> Cheers,
> ~Pierre
>
> --
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user