Re: Whiteout box function by Thomas Morley / need help

2016-03-06 Thread Simon Albrecht

On 06.03.2016 12:16, Karol Majewski wrote:
As for skylines: in a nutshell, skylines are invisible borders. 
Setting them to #'() affects the shape of these borders.


IIUC, it rather removes the skyline, making the grob invisible for 
spacing purposes, doesn’t it?


Best, Simon

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


Re: Whiteout box function by Thomas Morley / need help

2016-03-06 Thread Karol Majewski

Hi Andrew,
 
basically, this function allows to adjust the size of the whiteout box. It is especially useful in handling DynamicText-SpanBar collisions. Read the whole topic here:
 
http://lilypond.1069038.n5.nabble.com/Whiteout-box-function-by-Thomas-Morley-need-help-td161262.html
 
As for skylines: in a nutshell, skylines are invisible borders. Setting them to #'() affects the shape of these borders.
 
--Karol



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


Re: Whiteout box function by Thomas Morley / need help

2016-03-06 Thread Andrew Bernard
HI Karol,

Is there any introductory or tutorial material anywhere about vertical 
skylines, and horizontal? I confess I really have very little comprehension of 
this aspect of ilypond. [My perhaps myopic reading of the NR does not enlighten 
me.]

Why does that setting do the job? What is its function?

Andrew



On 6/03/2016, 20:55, "Karol Majewski" 
 wrote:

OK, it seems that \override DynamicLineSpanner.vertical-skylines = #'() does 
the job.

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


Re: Whiteout box function by Thomas Morley / need help

2016-03-06 Thread Karol Majewski

OK, it seems that \override DynamicLineSpanner.vertical-skylines = #'() does the job.
 

There is an issue with DynamicText placed at the end of hairpin.
 
If DynamicText is placed after the end of hairpin and some extraWhiteout is added to the left of DynamicText then the whole DynamicText is shifted to the right.
 
I want DynamicText to stay centered below note. Any suggestions are appreciated.
 
Here's an example:
 
BEGIN
 
moreWhiteout =#(define-music-function (parser location adds item)(pair? symbol-list-or-music?)  (define more-stencil-whiteout    (lambda (grob)  (let* ((function (assoc-get 'stencil    (reverse (ly:grob-basic-properties grob (stil   (if (and (procedure? function)    (not (eq? (procedure-name function)  'more-stencil-whiteout)))   (function grob)   (begin (ly:warning "~a has no stencil. Ignoring" grob) 
#f    (if stil    (let*((x-ext (ly:stencil-extent stil X))  (y-ext (ly:stencil-extent stil Y))  (add-to-x-ext (if (pair? (car adds)) (car adds) adds))  (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))  ;(self-alignment-X (ly:grob-property grob 'self-alignment-X))  (new-stil    (ly:make-stencil   (ly:stencil-expr stil)   (offset-add x-ext add-to-x-ext)   (offset-add y-ext add-to-y-ext  ;(display self-alignment-X)  (if (grob::has-interface grob 'dynamic-text-interface)  (let* ((new-stencil-length   (interval-length (ly:stencil-extent new-stil X))) 
(orig-stencil-length   (interval-length (ly:stencil-extent stil X    (ly:grob-set-property! grob 'self-alignment-X  (if (not (= 0 (- new-stencil-length orig-stencil-length)))  (/ (- (- new-stencil-length (cdr add-to-x-ext))    (+ orig-stencil-length (cdr add-to-x-ext))) new-stencil-length)  0  new-stil)    #f  #{    \tweak layer #10    \tweak whiteout ##t    \tweak stencil #more-stencil-whiteout 
#item  #})% EXAMPLE%%%\layout {  \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)}musicI = { \time 2/4 \repeat unfold 16 b8 }musicII = {  r2  b4 -\moreWhiteout #'((-2 . 0.5)(0 . 0)) ^"XX" -\moreWhiteout #'(0 . 4) ^"YY"  b  r ^\<  r  b4 -\moreWhiteout #'((-6 . 0) (-1 . 1)) 
^\"pp" b}\new StaffGroup <<  \new Staff \relative c'' \musicI  \new Staff \relative c'' \musicII>>
 
END==





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


Re: Whiteout box function by Thomas Morley / need help

2016-03-05 Thread Karol Majewski

There is an issue with DynamicText placed at the end of hairpin.
 
If DynamicText is placed after the end of hairpin and some extraWhiteout is added to the left of DynamicText then the whole DynamicText is shifted to the right.
 
I want DynamicText to stay centered below note. Any suggestions are appreciated.
 
Here's an example:
 
BEGIN
 
moreWhiteout =#(define-music-function (parser location adds item)(pair? symbol-list-or-music?)  (define more-stencil-whiteout    (lambda (grob)  (let* ((function (assoc-get 'stencil    (reverse (ly:grob-basic-properties grob (stil   (if (and (procedure? function)    (not (eq? (procedure-name function)  'more-stencil-whiteout)))   (function grob)   (begin (ly:warning "~a has no stencil. Ignoring" grob) 
#f    (if stil    (let*((x-ext (ly:stencil-extent stil X))  (y-ext (ly:stencil-extent stil Y))  (add-to-x-ext (if (pair? (car adds)) (car adds) adds))  (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))  ;(self-alignment-X (ly:grob-property grob 'self-alignment-X))  (new-stil    (ly:make-stencil   (ly:stencil-expr stil)   (offset-add x-ext add-to-x-ext)   (offset-add y-ext add-to-y-ext  ;(display self-alignment-X)  (if (grob::has-interface grob 'dynamic-text-interface)  (let* ((new-stencil-length   (interval-length (ly:stencil-extent new-stil X))) 
(orig-stencil-length   (interval-length (ly:stencil-extent stil X    (ly:grob-set-property! grob 'self-alignment-X  (if (not (= 0 (- new-stencil-length orig-stencil-length)))  (/ (- (- new-stencil-length (cdr add-to-x-ext))    (+ orig-stencil-length (cdr add-to-x-ext))) new-stencil-length)  0  new-stil)    #f  #{    \tweak layer #10    \tweak whiteout ##t    \tweak stencil #more-stencil-whiteout 
#item  #})% EXAMPLE%%%\layout {  \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)}musicI = { \time 2/4 \repeat unfold 16 b8 }musicII = {  r2  b4 -\moreWhiteout #'((-2 . 0.5)(0 . 0)) ^"XX" -\moreWhiteout #'(0 . 4) ^"YY"  b  r ^\<  r  b4 -\moreWhiteout #'((-6 . 0) (-1 . 1)) 
^\"pp" b}\new StaffGroup <<  \new Staff \relative c'' \musicI  \new Staff \relative c'' \musicII>> 
 
END==



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


Re: Whiteout box function by Thomas Morley / need help

2014-06-14 Thread Karol Majewski

Done! :-)


moreWhiteout =#(define-music-function (parser location adds item)(pair? symbol-list-or-music?) (define more-stencil-whiteout (lambda (grob) (let* ((function (assoc-get 'stencil (reverse (ly:grob-basic-properties grob (stil  (if (and (procedure? function) (not (eq? (procedure-name function) 'more-stencil-whiteout))) (function grob) (begin (ly:warning "~a has no stencil. Ignoring" grob) 
#f (if stil (let*((x-ext (ly:stencil-extent stil X)) (y-ext (ly:stencil-extent stil Y)) (add-to-x-ext (if (pair? (car adds)) (car adds) adds)) (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0))) ;(self-alignment-X (ly:grob-property grob 'self-alignment-X)) (new-stil (ly:make-stencil (ly:stencil-expr stil) (offset-add x-ext add-to-x-ext) (offset-add y-ext add-to-y-ext ;(display self-alignment-X) (if (grob::has-interface grob 'dynamic-text-interface) (let* ((new-stencil-length (interval-length (ly:stencil-extent new-stil X))) 
(orig-stencil-length (interval-length (ly:stencil-extent stil X (ly:grob-set-property! grob 'self-alignment-X (if (not (= 0 (- new-stencil-length orig-stencil-length))) (/ (- (- new-stencil-length (cdr add-to-x-ext)) (+ orig-stencil-length (cdr add-to-x-ext))) new-stencil-length) 0 new-stil) #f #{ \tweak layer #10 \tweak whiteout ##t \tweak stencil #more-stencil-whiteout 
#item #})% EXAMPLE%%%\layout { \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)}musicI = { \time 2/4 \repeat unfold 16 b8 }musicII = { r2 b4 -\moreWhiteout #'((-2 . 0.5)(0 . 0)) ^"XX" -\moreWhiteout #'(0 . 4) ^"YY" b r r -\moreWhiteout #'((-3.2 . 4.12)(0 . 0)) ^\ 
b4 -\moreWhiteout #'(-2 . 10.5) ^"XX" b}\new StaffGroup  \new Staff \relative c'' \musicI \new Staff \relative c'' \musicII 


--Karol



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


Re: Whiteout box function by Thomas Morley / need help

2014-06-13 Thread Karol Majewski

Thanks, David.

I've looked into this, but have no idea what's going on there. Here's crippled version of extraWhiteout function - works only for TextScript and allows to set X-extent only. But still don't know how to turn this into \tweak.

extraWhiteout =#(define-music-function (parser location adds) (pair?) (define more-stencil-whiteout (lambda (grob) (let* ((function (assoc-get 'stencil 
(reverse (ly:grob-basic-properties grob (stil (if (and (procedure? function) (not (eq? (procedure-name function) 'more-stencil-whiteout))) (function grob) (begin (ly:warning "" grob) #f (if stil (let* ((x-ext (ly:stencil-extent stil X)) (add-to-x-ext (if (pair? (car adds)) (car adds) adds)) (new-stil (ly:make-stencil (ly:stencil-expr stil) (offset-add x-ext add-to-x-ext) (ly:stencil-extent stil Y new-stil) #f #{ \once \override TextScript.layer = 
#10 \once \override TextScript.whiteout = ##t \once \override TextScript.stencil = #more-stencil-whiteout #})%%%musicI = { \time 2/4 \repeat unfold 16 b8 }musicII = { r2 \extraWhiteout #'(-2 . 0.5) b4 ^"XX" b r r^\ \extraWhiteout #'(-2 . 10.5) b4 ^"XX" b}\new StaffGroup 
 \new Staff \relative c'' \musicI \new Staff \relative c'' \musicII



--Karol



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


Re: Whiteout box function by Thomas Morley / need help

2014-06-12 Thread Karol Majewski
I'm trying to make this function work via \tweak. Grob-name string is no longer 
needed. The following code doesn't work. Perhaps I missed something that is 
obvious to schemers. Any ideas are welcome.

moreWhiteout =
#(define-music-function (parser location adds)(pair?)
  (define more-stencil-whiteout
(lambda (grob)
  (let* ((function (assoc-get 'stencil
(reverse (ly:grob-basic-properties grob
 (stil
   (if (and (procedure? function)
(not (eq? (procedure-name function)
  'more-stencil-whiteout)))
   (function grob)
   (begin
 (ly:warning ~a has no stencil. Ignoring grob)
 #f
(if stil
(let*((x-ext (ly:stencil-extent stil X))
  (y-ext (ly:stencil-extent stil Y))
  (add-to-x-ext (if (pair? (car adds)) (car adds) adds))
  (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))
  (new-stil
(ly:make-stencil
   (ly:stencil-expr stil)
   (offset-add x-ext add-to-x-ext)
   (offset-add y-ext add-to-y-ext
  (if (grob::has-interface grob 'dynamic-text-interface)
  (let* ((new-stencil-length
   (interval-length (ly:stencil-extent new-stil X)))
 (orig-stencil-length
   (interval-length (ly:stencil-extent stil X
(ly:grob-set-property! grob 'self-alignment-X
  (if (not (= 0 (- new-stencil-length orig-stencil-length)))
  (/ (- (- new-stencil-length (cdr add-to-x-ext))
(+ orig-stencil-length (cdr add-to-x-ext)))
 new-stencil-length)
  0
  new-stil)
#f
  #{
-\tweak layer #10
-\tweak whiteout ##t
-\tweak stencil #more-stencil-whiteout
  #})

%%%
%% EXAMPLE
%%%

\layout {
  \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
}

musicI = { \time 2/4 \repeat unfold 16 b8 }

musicII = {
  r2
  b4 \moreWhiteout #'((-2 . 0.5)(0 . 2)) ^XX
  b
  r
  
  r^ \moreWhiteout #'((-3.2 . 4.12)(0 . 0)) \  
  b4 \moreWhiteout #'(-2 . 10.5) ^XX b
}

\new StaffGroup 
  \new Staff \relative c'' \musicI
  \new Staff \relative c'' \musicII





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


Re: Whiteout box function by Thomas Morley / need help

2014-06-12 Thread David Nalesnik
Hi Karol,


On Thu, Jun 12, 2014 at 12:48 PM, Karol Majewski karo...@wp.pl wrote:

 I'm trying to make this function work via \tweak. Grob-name string is no
 longer needed. The following code doesn't work. Perhaps I missed something
 that is obvious to schemers. Any ideas are welcome.

 moreWhiteout =
 #(define-music-function (parser location adds)(pair?)
   (define more-stencil-whiteout
 (lambda (grob)
   (let* ((function (assoc-get 'stencil
 (reverse (ly:grob-basic-properties grob
  (stil
(if (and (procedure? function)
 (not (eq? (procedure-name function)
   'more-stencil-whiteout)))
(function grob)
(begin
  (ly:warning ~a has no stencil. Ignoring grob)
  #f
 (if stil
 (let*((x-ext (ly:stencil-extent stil X))
   (y-ext (ly:stencil-extent stil Y))
   (add-to-x-ext (if (pair? (car adds)) (car adds) adds))
   (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 .
 0)))
   (new-stil
 (ly:make-stencil
(ly:stencil-expr stil)
(offset-add x-ext add-to-x-ext)
(offset-add y-ext add-to-y-ext
   (if (grob::has-interface grob 'dynamic-text-interface)
   (let* ((new-stencil-length
(interval-length (ly:stencil-extent new-stil
 X)))
  (orig-stencil-length
(interval-length (ly:stencil-extent stil X
 (ly:grob-set-property! grob 'self-alignment-X
   (if (not (= 0 (- new-stencil-length
 orig-stencil-length)))
   (/ (- (- new-stencil-length (cdr add-to-x-ext))
 (+ orig-stencil-length (cdr add-to-x-ext)))
  new-stencil-length)
   0
   new-stil)
 #f
   #{
 -\tweak layer #10
 -\tweak whiteout ##t
 -\tweak stencil #more-stencil-whiteout
   #})

 %%%
 %% EXAMPLE
 %%%

 \layout {
   \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
 }

 musicI = { \time 2/4 \repeat unfold 16 b8 }

 musicII = {
   r2
   b4 \moreWhiteout #'((-2 . 0.5)(0 . 2)) ^XX
   b
   r

   r^ \moreWhiteout #'((-3.2 . 4.12)(0 . 0)) \
   b4 \moreWhiteout #'(-2 . 10.5) ^XX b
 }

 \new StaffGroup 
   \new Staff \relative c'' \musicI
   \new Staff \relative c'' \musicII
 


You might look to see how \shape is defined in ly/music-functions-init.ly.

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-25 Thread Karol Majewski
Hi Harm. This is quite an impressive piece of code! So far everything is fine 
:-) Thank you very much. It should be added to LSR, I think.




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


Re: Whiteout box function by Thomas Morley / need help

2014-04-24 Thread Thomas Morley
2014-04-21 16:40 GMT+02:00 Karol Majewski karo...@wp.pl:
 Harm,

 this change is related to issue 621:
 http://code.google.com/p/lilypond/issues/detail?id=621

 Now, I do not accept this solution. It is simply against the rules. 
 DynamicText shouldn't have influence on spacaing. Therefore I prefer whiteout.

 So I use:

 \context {
   \Staff
   \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
 }

 Note that your previous function (the one that contains 
 flexible-stencil-whiteout) works well with DynamiText. But the drawback is 
 that it doesn't allow to set left and right X-extent.

 -- Karol

Hi Karol,

below the newest version.
DynamicText is special-cased and it always returns a visual output for
DynamicText like
'self-alignment -X = CENTER

Please test:

\version 2.19.4

moreWhiteout =
#(define-music-function (parser location grob-name adds)(string? pair?)

 Increases the grob-stencil for 'whiteout, setting the 'layer to 10.
 DynamicText is special-cased:
   It's 'self-alignment-X is calculated to ensure same visual output as if
   'self-alignment-X = CENTER
   TODO: Make it work for other values of 'self-alignment-X


  (define more-stencil-whiteout
(lambda (grob)
  (let* ((function (assoc-get 'stencil
(reverse (ly:grob-basic-properties grob
 (stil ;; Ugh, is there no better way to test that a grob has no
   ;; 'stencil and that no other previous procedure assigned
   ;; a stencil-value to said grob?
   (if (and (procedure? function)
(not (eq? (procedure-name function)
  'more-stencil-whiteout)))
   (function grob)
   (begin
 (ly:warning ~a has no stencil. Ignoring grob)
 #f
(if stil
(let*((x-ext (ly:stencil-extent stil X))
  (y-ext (ly:stencil-extent stil Y))
  (add-to-x-ext (if (pair? (car adds)) (car adds) adds))
  (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))
  ;(self-alignment-X (ly:grob-property grob 'self-alignment-X))
  (new-stil
(ly:make-stencil
   (ly:stencil-expr stil)
   (offset-add x-ext add-to-x-ext)
   (offset-add y-ext add-to-y-ext
  ;(display self-alignment-X)
  (if (grob::has-interface grob 'dynamic-text-interface)
  ;(and (not (null? self-alignment-X)) (= 0 self-alignment-X))
  (let* ((new-stencil-length
   (interval-length (ly:stencil-extent new-stil X)))
 (orig-stencil-length
   (interval-length (ly:stencil-extent stil X
(ly:grob-set-property! grob 'self-alignment-X
  (if (not (= 0 (- new-stencil-length orig-stencil-length)))
  (/ (- (- new-stencil-length (cdr add-to-x-ext))
(+ orig-stencil-length (cdr add-to-x-ext)))
 new-stencil-length)
  0
  new-stil)
#f
  #{
\once \override $grob-name . layer = #10
\once \override $grob-name . whiteout = ##t
\once \override $grob-name . stencil = #more-stencil-whiteout
  #})

%%%
%% EXAMPLE
%%%

\layout {
  \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
}

musicI = { \time 2/4 \repeat unfold 16 b8 }

musicII = {
  r2
  %% apply to X- and Y-axis
  \moreWhiteout TextScript #'((-2 . 0.5)(0 . 2))
  b4^XX
  b
  r
  \moreWhiteout DynamicText #'((-3.2 . 4.12)(0 . 0))
  r^\
  %% apply to X-axis only
  \moreWhiteout TextScript #'(-2 . 10.5)
  b4^XX b
}

\new StaffGroup 
  \new Staff \relative c'' \musicI
  \new Staff \relative c'' \musicII



Cheers,
  Harm

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-22 Thread David Kastrup
Karol Majewski karo...@wp.pl writes:

 Although I know nothing about scheme, I've managed to slim down this 
 function, so that there are no optional arguments. Now I'll try to find out 
 why it doesn't work for DynamicText grob.

 Harm, thanks in advance for any hints. Perhaps we can mix your function with 
 flexible-stencil-whiteout (see my first post).

 %

 \version 2.19.5

 moreWhiteout =
 #(define-music-function
   (parser location adds)
   (pair?)
   (define
 (interval-add iv-1 iv-2)
 (cons
   (+
 (car iv-1)
 (car iv-2))
   (+
 (cdr iv-1)
 (cdr iv-2

That's a misnomer since it does not add intervals.  Functionally, it
is the same as offset-add, or (cons-map + iv-1 iv-2).

-- 
David Kastrup

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-21 Thread Karol Majewski
Although I know nothing about scheme, I've managed to slim down this function, 
so that there are no optional arguments. Now I'll try to find out why it 
doesn't work for DynamicText grob.

Harm, thanks in advance for any hints. Perhaps we can mix your function with 
flexible-stencil-whiteout (see my first post).

%

\version 2.19.5

moreWhiteout =
#(define-music-function
  (parser location adds)
  (pair?)
  (define
(interval-add iv-1 iv-2)
(cons
  (+
(car iv-1)
(car iv-2))
  (+
(cdr iv-1)
(cdr iv-2
  (define more-stencil-whiteout
(lambda
  (grob)
  (let*
((stil
(ly:text-interface::print grob))
  (x-ext
(ly:stencil-extent stil X))
  (y-ext
(ly:stencil-extent stil Y))
  (add-to-x-ext
(if
  (pair?
(car adds))
  (car adds) adds))
  (add-to-y-ext
(if
  (pair?
(cdr adds))
  (cadr adds) '(0 . 0)))
  (new-stil
(ly:make-stencil
  (ly:stencil-expr stil)
  (interval-add x-ext add-to-x-ext)
  (interval-add y-ext add-to-y-ext new-stil)))
  #{
\once \override DynamicText . layer = #10
\once \override DynamicText . whiteout = ##t
\once \override DynamicText . stencil = #more-stencil-whiteout
  #})

%%%
%% EXAMPLE
%%%

musicI = { \time 2/4 \repeat unfold 16 b8 }

musicII = {
  r2
  %% apply to X- and Y-axis
  \moreWhiteout #'((-2 . 0.5)(0 . 2))
  b4 \ff b
  r2
  %% apply to X-axis only
  \moreWhiteout #'(-2 . 0.5)
  b4 \mf b
}


\new StaffGroup 
  \new Staff \relative c'' \musicI
  \new Staff \relative c'' \musicII


%


-- Karol



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


Re: Whiteout box function by Thomas Morley / need help

2014-04-21 Thread Thomas Morley
Hi Karol,

sorry coming back to you that late.

2014-04-21 13:22 GMT+02:00 Karol Majewski karo...@wp.pl:
 Although I know nothing about scheme, I've managed to slim down this 
 function, so that there are no optional arguments. Now I'll try to find out 
 why it doesn't work for DynamicText grob.

It seems thee was some change in the source concerning DynamicText.

Look at the attached images produced from the following code with
2.18.0 and 2.19.4

\new StaffGroup

\new Staff \relative c' {
c1
\override DynamicText #'X-offset = #-20
\once \override DynamicText #'whiteout = ##t
c\f
c
}
\new Staff \relative c' {
c1 c c
}


It seems now to be impossible to move DynamicText across BarLines.
(You can use 'extra-offset ofcourse, though it's usually a bad idea.)

Obviously, it was made to avoid any BarLine/DynamicText collisions.
If it always works, there would be no more need for any whiteout
function for DynamicText.

Do you encounter collisions anywhere?
If yes, please report.

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-21 Thread Thomas Morley
2014-04-21 16:02 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 Hi Karol,

 sorry coming back to you that late.

 2014-04-21 13:22 GMT+02:00 Karol Majewski karo...@wp.pl:
 Although I know nothing about scheme, I've managed to slim down this 
 function, so that there are no optional arguments. Now I'll try to find out 
 why it doesn't work for DynamicText grob.

 It seems thee was some change in the source concerning DynamicText.

 Look at the attached images produced from the following code with
 2.18.0 and 2.19.4

 \new StaffGroup
 
 \new Staff \relative c' {
 c1

Please note, the images from my last post were made without the
'X-offset-override:

 \override DynamicText #'X-offset = #-20
 \once \override DynamicText #'whiteout = ##t
 c\f
 c
 }
 \new Staff \relative c' {
 c1 c c
 }


 It seems now to be impossible to move DynamicText across BarLines.
 (You can use 'extra-offset ofcourse, though it's usually a bad idea.)

 Obviously, it was made to avoid any BarLine/DynamicText collisions.
 If it always works, there would be no more need for any whiteout
 function for DynamicText.

 Do you encounter collisions anywhere?
 If yes, please report.

 Cheers,
   Harm

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-21 Thread Karol Majewski
Harm,

this change is related to issue 621:
http://code.google.com/p/lilypond/issues/detail?id=621

Now, I do not accept this solution. It is simply against the rules. DynamicText 
shouldn't have influence on spacaing. Therefore I prefer whiteout.

So I use:

\context {
  \Staff
  \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
}

Note that your previous function (the one that contains 
flexible-stencil-whiteout) works well with DynamiText. But the drawback is that 
it doesn't allow to set left and right X-extent.

-- Karol




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


Re: Whiteout box function by Thomas Morley / need help

2014-04-21 Thread Thomas Morley
2014-04-21 16:40 GMT+02:00 Karol Majewski karo...@wp.pl:
 Harm,

 this change is related to issue 621:
 http://code.google.com/p/lilypond/issues/detail?id=621

 Now, I do not accept this solution. It is simply against the rules. 
 DynamicText shouldn't have influence on spacaing. Therefore I prefer whiteout.

 So I use:

 \context {
   \Staff
   \override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
 }


Ahh, ok.
Now I understand your remark here
http://lists.gnu.org/archive/html/lilypond-user/2014-04/msg00204.html

The following will give different result for extra-spacing-width
depending on presence of spanbars:

\version 2.19.4

dynamic-text-extra-spacing-width-info =
  \override DynamicText.after-line-breaking =
#(lambda (grob)
   (newline)(write (ly:grob-property grob 'extra-spacing-width)))

m = \new Staff { c1 \dynamic-text-extra-spacing-width-info c\f }

 \m \m 
\new StaffGroup  \m \m 

Will look in the whiteout-function ...

Cheers,
  Harm

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-09 Thread Karol Majewski
Hi Harm

Function you wrote few days ago works for TextScript but not for DynamicText:

\moreWhiteout DynamicText #'(7 . 0) c'1

And only X-offset is added to DynamicText.


--Karol




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


Re: Whiteout box function by Thomas Morley / need help

2014-04-09 Thread Karol Majewski
The following:

{
  \moreWhiteout DynamicText #'(2 . 0) c'1 \f
}

gives:
warning: DynamicText has empty extent and non-empty stencil.
warning: Not drawing a box with negative dimension, -0.74 by 2.59.

Warnings dissapear when \f is replaced by \mf.


-Karol

 Hi Harm
 
 Function you wrote few days ago works for TextScript but not for 
 DynamicText:
 
 \moreWhiteout DynamicText #'(7 . 0) c'1
 
 And only X-offset is added to DynamicText.
 
 
 --Karol
 
 
 
 
 ___
 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: Whiteout box function by Thomas Morley / need help

2014-04-09 Thread Thomas Morley
2014-04-09 18:50 GMT+02:00 Karol Majewski karo...@wp.pl:
 Hi Harm

 Function you wrote few days ago works for TextScript but not for DynamicText:

 \moreWhiteout DynamicText #'(7 . 0) c'1

 And only X-offset is added to DynamicText.


 --Karol




Hi Karol,

I'm on it.
Though, because of little free time don't expect a new version before
the upcoming weekend. :(

Cheers,
  Harm

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-07 Thread David Kastrup
Thomas Morley thomasmorle...@gmail.com writes:

 2014-04-06 11:39 GMT+02:00 Karol Majewski karo...@wp.pl:
 Thanks Harm.

 In SpanBar-Dynamics conflict I still prefer whiteout over
 DynamicText.extra-spacing-width = ##f. The only problem is that
 sometimes whiteout box does not cover the whole barline
 width. Function I'm asking for would allow to control the width of
 whiteout box.

 Hi Karol,

 below the revised function.
 'moreWhiteout' takes one optional and two normal arguments:
 Specifying whether the stencil should be boxed (boolean), which grob
 (string) and the values to extent the stencil.

We could do this kind of whitening-out at least in the PostScript
backend (and consequently, PDF and PNG): you can convert characters into
filled paths and then stroke them with a circular pencil.  However, we
don't get any metrics back from the backend, so this would not be useful
for positioning, only for whiteout behind already positioned items.  And
I don't know what capabilities SVG would have here, if at all.

But it would likely be the graphically most convincing solution short of
creating our own skyline padder.  Which is also quite feasible, would be
backend independent, but a bit of work.

-- 
David Kastrup

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-07 Thread Karol Majewski
Thanks again Harm. This is very useful function. Hopefully I'm not the only one 
who appreciates it.


 
 Hi Karol,
 
 below the revised function.
 'moreWhiteout' takes one optional and two normal arguments:
 Specifying whether the stencil should be boxed (boolean), which grob
 (string) and the values to extent the stencil. These values can be
 given as simple pair, affecting only X-axis-extension or as list of
 pairs, affecting X- and Y-axis-extent.
 The boolean may be of some use for debugging, though it will affect
 spacing! Perhaps I should delete it ...
 
 Otherwise I did some clean up and made the function more robust.
 Please test.
 
 \version 2.19.3
 
 moreWhiteout =
 #(define-music-function (parser location better-viewing? grob-name adds)
   ((boolean? #f) string? pair?)
 
   (define (interval-add iv-1 iv-2)
 (cons (+ (car iv-1)(car iv-2))
   (+ (cdr iv-1)(cdr iv-2
 
   (define more-stencil-whiteout
 (lambda (grob)
   (let* ((function (assoc-get 'stencil
 (reverse (ly:grob-basic-properties grob
  (stil ;; Ugh, is there no better way to test that a grob has no
;; 'stencil and that no other previous procedure assigned
;; a stencil-value to said grob?
(if (and (procedure? function)
 (not (eq? (procedure-name function)
   'more-stencil-whiteout)))
(function grob)
(begin
  (ly:warning ~a has no stencil. Ignoring grob)
  #f
 (if stil
 (let*((x-ext (ly:stencil-extent stil X))
   (y-ext (ly:stencil-extent stil Y))
   (add-to-x-ext (if (pair? (car adds)) (car adds) adds))
   (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))
   (new-stil (ly:make-stencil
(ly:stencil-expr stil)
(interval-add x-ext add-to-x-ext)
(interval-add y-ext add-to-y-ext
 
 
;; please note: setting better-viewing #t, will add a little
;; padding around the new stil and it will affect spacing in 
 most
;; other cases, too.
;; We let it in, perhaps it may be of some help in certain 
 cases.
(if better-viewing?
(box-stencil new-stil 0.1 0.01)
new-stil))
 #f
 
   #{
 %% Seems no longer needed:
 %\once \override $grob-name . vertical-skylines = #'()
 %% Better to add next two lines:
 \once \override $grob-name . layer = #10
 \once \override $grob-name . whiteout = ##t
 \once \override $grob-name . stencil = #more-stencil-whiteout
   #})
 
 %%%
 %% EXAMPLE
 %%%
 
 musicI = { \time 2/4 \repeat unfold 16 b8 }
 
 musicII = {
   r2
   %% apply to X- and Y-axis
   \moreWhiteout TextScript #'((-2 . 0.5)(0 . 2))
   b4^XX b
   r2
   %% apply to X-axis only
   \moreWhiteout ##t TextScript #'(-2 . 0.5)
   b4^XX b
 }
 
 
 \new StaffGroup 
   \new Staff \relative c'' \musicI
   \new Staff \relative c'' \musicII
 
 
 Ofcourse the extension happens as a rectangle.
 No idea to do it different.
 
  BTW, In documentation for 2.19 it's written that default value for 
 DynamicText.extra-spacing-width is '(+inf.0 . -inf.0), which is not true 
 anymore.
 
 I think you're wrong.
 The following returns '(+inf.0 . -inf.0) !
 
 {
   \override DynamicText.after-line-breaking =
 #(lambda (grob) (write (ly:grob-property grob 'extra-spacing-width)))
   c1\f
 }
 
 HTH,
   Harm




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


Re: Whiteout box function by Thomas Morley / need help

2014-04-06 Thread Karol Majewski
Thanks Harm.

In SpanBar-Dynamics conflict I still prefer whiteout over 
DynamicText.extra-spacing-width = ##f. The only problem is that sometimes 
whiteout box does not cover the whole barline width. Function I'm asking for 
would allow to control the width of whiteout box.

BTW, In documentation for 2.19 it's written that default value for 
DynamicText.extra-spacing-width is '(+inf.0 . -inf.0), which is not true 
anymore.


 Hi Karol,
 
 will have a look at it tomorrow, right now I'm overtired ...
 
 Cheers,
   Harm




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


Re: Whiteout box function by Thomas Morley / need help

2014-04-06 Thread Kieren MacMillan
Hi all,

 Function I'm asking for would allow to control the width of whiteout box.

Just to note [again] that I would much prefer a whiteout function that followed 
the glyph outline (with a padding or margin parameter), rather than a rectangle.
And, of course, I’m happy to chip in bounty money for it…

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-06 Thread Simon Albrecht


Am 06.04.2014 16:38, schrieb Kieren MacMillan:

Hi all,


Function I'm asking for would allow to control the width of whiteout box.

Just to note [again] that I would much prefer a whiteout function that followed 
the glyph outline (with a padding or margin parameter), rather than a rectangle.

+1
This is important, for example because the dynamic f reaches far beyond 
the whiteout box.


All the best,
Simon

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


Re: Whiteout box function by Thomas Morley / need help

2014-04-06 Thread Thomas Morley
2014-04-06 11:39 GMT+02:00 Karol Majewski karo...@wp.pl:
 Thanks Harm.

 In SpanBar-Dynamics conflict I still prefer whiteout over 
 DynamicText.extra-spacing-width = ##f. The only problem is that sometimes 
 whiteout box does not cover the whole barline width. Function I'm asking for 
 would allow to control the width of whiteout box.

Hi Karol,

below the revised function.
'moreWhiteout' takes one optional and two normal arguments:
Specifying whether the stencil should be boxed (boolean), which grob
(string) and the values to extent the stencil. These values can be
given as simple pair, affecting only X-axis-extension or as list of
pairs, affecting X- and Y-axis-extent.
The boolean may be of some use for debugging, though it will affect
spacing! Perhaps I should delete it ...

Otherwise I did some clean up and made the function more robust.
Please test.

\version 2.19.3

moreWhiteout =
#(define-music-function (parser location better-viewing? grob-name adds)
  ((boolean? #f) string? pair?)

  (define (interval-add iv-1 iv-2)
(cons (+ (car iv-1)(car iv-2))
  (+ (cdr iv-1)(cdr iv-2

  (define more-stencil-whiteout
(lambda (grob)
  (let* ((function (assoc-get 'stencil
(reverse (ly:grob-basic-properties grob
 (stil ;; Ugh, is there no better way to test that a grob has no
   ;; 'stencil and that no other previous procedure assigned
   ;; a stencil-value to said grob?
   (if (and (procedure? function)
(not (eq? (procedure-name function)
  'more-stencil-whiteout)))
   (function grob)
   (begin
 (ly:warning ~a has no stencil. Ignoring grob)
 #f
(if stil
(let*((x-ext (ly:stencil-extent stil X))
  (y-ext (ly:stencil-extent stil Y))
  (add-to-x-ext (if (pair? (car adds)) (car adds) adds))
  (add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))
  (new-stil (ly:make-stencil
   (ly:stencil-expr stil)
   (interval-add x-ext add-to-x-ext)
   (interval-add y-ext add-to-y-ext


   ;; please note: setting better-viewing #t, will add a little
   ;; padding around the new stil and it will affect spacing in most
   ;; other cases, too.
   ;; We let it in, perhaps it may be of some help in certain cases.
   (if better-viewing?
   (box-stencil new-stil 0.1 0.01)
   new-stil))
#f

  #{
%% Seems no longer needed:
%\once \override $grob-name . vertical-skylines = #'()
%% Better to add next two lines:
\once \override $grob-name . layer = #10
\once \override $grob-name . whiteout = ##t
\once \override $grob-name . stencil = #more-stencil-whiteout
  #})

%%%
%% EXAMPLE
%%%

musicI = { \time 2/4 \repeat unfold 16 b8 }

musicII = {
  r2
  %% apply to X- and Y-axis
  \moreWhiteout TextScript #'((-2 . 0.5)(0 . 2))
  b4^XX b
  r2
  %% apply to X-axis only
  \moreWhiteout ##t TextScript #'(-2 . 0.5)
  b4^XX b
}


\new StaffGroup 
  \new Staff \relative c'' \musicI
  \new Staff \relative c'' \musicII


Ofcourse the extension happens as a rectangle.
No idea to do it different.

 BTW, In documentation for 2.19 it's written that default value for 
 DynamicText.extra-spacing-width is '(+inf.0 . -inf.0), which is not true 
 anymore.

I think you're wrong.
The following returns '(+inf.0 . -inf.0) !

{
  \override DynamicText.after-line-breaking =
#(lambda (grob) (write (ly:grob-property grob 'extra-spacing-width)))
  c1\f
}

HTH,
  Harm

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


Whiteout box function by Thomas Morley / need help

2014-04-05 Thread Karol Majewski
This is a function written by Thomas Morley. It allows to control width and 
height of whiteout box. Now I want to modify this function to make it work like:

\dynamicTextWhiteout #'(1 . 2)

where:
  - first number is LEFT X-extent
  - second number is RIGHT X-extent

I don't need Y-extent at all.


Don't quite know how to do this. Any hints would be appreciated.

Thanks,
Karol


%%

\version 2.19.1

dynamicTextWhiteout =
#(define-music-function
  (parser location adds)
  (pair?)
  (define
(flexible-stencil-whiteout add stencil)
(let*
  ((x-ext
  (ly:stencil-extent stencil X))
(y-ext
  (ly:stencil-extent stencil Y)))
  (ly:stencil-add
(stencil-with-color
  (ly:round-filled-box
(interval-widen x-ext
  (car add))
(interval-widen y-ext
  (cdr add)) 0) green) stencil)))
  (define more-stencil-whiteout
(lambda
  (grob)
  (let*
((stil
(ly:text-interface::print grob))
  (x-ext
(ly:stencil-extent stil X))
  (y-ext
(ly:stencil-extent stil Y))
  (whiteout-stil
(flexible-stencil-whiteout adds stil)))
(ly:make-stencil
  (ly:stencil-expr whiteout-stil) x-ext y-ext
  #{
\override DynamicText.vertical-skylines = #'()
\once \override DynamicText.stencil = #more-stencil-whiteout
  #})

{
  \dynamicTextWhiteout #'(1 . 0) c'4 \f
}

%



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


Re: Whiteout box function by Thomas Morley / need help

2014-04-05 Thread Thomas Morley
2014-04-06 0:09 GMT+02:00 Karol Majewski karo...@wp.pl:
 This is a function written by Thomas Morley. It allows to control width and 
 height of whiteout box. Now I want to modify this function to make it work 
 like:

 \dynamicTextWhiteout #'(1 . 2)

 where:
   - first number is LEFT X-extent
   - second number is RIGHT X-extent

 I don't need Y-extent at all.


 Don't quite know how to do this. Any hints would be appreciated.

 Thanks,
 Karol

Hi Karol,

will have a look at it tomorrow, right now I'm overtired ...

Cheers,
  Harm

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