lilypond-user
[Top][All Lists]
Advanced

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

Re: again: problem with hide curves


From: David Nalesnik
Subject: Re: again: problem with hide curves
Date: Fri, 21 Mar 2014 08:11:25 -0500

Hi Stefan,


On Fri, Mar 21, 2014 at 6:00 AM, Stefan Thomas <address@hidden> wrote:
Dear community,
I have a problem with the function

hideCurvesFrom which I use sometimes.


Where did you get this function?
 

When I compile the following snippet I get the error message:

Drawing systems...bogenvorzeichenkollision.ly:41:27: In procedure ly:stencil-extent in _expression_ (ly:stencil-extent this-stil 0):
bogenvorzeichenkollision.ly:41:27: Wrong type argument in position 1 (expecting Stencil): ()

I can't see, what's going wrong here.


I don't have time to figure out exactly what's going on here, but the error message is instructive.  A quick fix would be to check if this-stil is '().  See inserted line below:
 

\version "2.18.2"

#(define (parse-grob-sym grob-sym)

(let* ((grob-str (symbol->string grob-sym))

(dot-index (string-index grob-str #\.))

(context (if dot-index

(string-take grob-str dot-index)

"Voice"))

(grob (if dot-index

(substring grob-str (+ dot-index 1))

grob-str)))

(cons context grob)))


hideCurvesFrom =

#(define-music-function

(parser location grob-sym x-padding y-padding)

(symbol? pair? pair?)

(let* ((context (car (parse-grob-sym grob-sym)))

(top-grob (cdr (parse-grob-sym grob-sym))))

#{

\override Tie.layer = #-2

\override Slur.layer = #-2

\override PhrasingSlur.layer = #-2


\override $context . $top-grob #'avoid-slur = #'ignore

\override $context . $top-grob #'layer = #-1

\override $context . $top-grob #'stencil =

#(lambda (grob)

(define (get-stil-proc alist)

;; removes the first 'stencil entry from the grob-property

;; alist, implicitly created by this callback:

;; (stencil . #<procedure #f (grob)>)

;; and then retrieves the original 'stencil procedure.

(let ((stil-proc (ly:assoc-get 'stencil alist)))

(if (procedure-name stil-proc)

stil-proc

(begin (set! alist (assoc-remove! alist 'stencil))

(get-stil-proc alist)))))

(let* ((basic-props (ly:grob-basic-properties grob))

(stil-proc (get-stil-proc basic-props))

(this-stil (stil-proc grob))


Insert the following line:
 
  (this-stil (if (null? this-stil) point-stencil this-stil))
 

(stil-x-ext (ly:stencil-extent this-stil 0))

(stil-y-ext (ly:stencil-extent this-stil 1))

(box-x-ext (cons (- (car stil-x-ext) (car x-padding))

(+ (cdr stil-x-ext) (cdr x-padding))))

(box-y-ext (cons (- (car stil-y-ext) (car y-padding))

(+ (cdr stil-y-ext) (cdr y-padding))))

(box-w (- (cdr box-x-ext) (car box-x-ext)))

(box-h (- (cdr box-y-ext) (car box-y-ext))))

(ly:stencil-add

(ly:make-stencil

(list 'embedded-ps

(ly:format

(string-append "gsave\n"

"currentpoint translate\n"

"1 setgray\n"

"~4f ~4f ~4f ~4f rectfill\n"

"grestore\n")

(car box-x-ext)

(car box-y-ext)

box-w

box-h))

stil-x-ext

stil-y-ext)

this-stil)))

#}))


[etc.]

Also, all the formatting seems to be stripped from your code insert, which makes it all but unreadable.  If this is a persistent problem, could you attach your code in a file?

Best,
David 


reply via email to

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