[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another 'wrong type argument' error
From: |
Thomas Morley |
Subject: |
Re: another 'wrong type argument' error |
Date: |
Sun, 9 Oct 2022 21:01:10 +0200 |
Am So., 9. Okt. 2022 um 20:51 Uhr schrieb Kieren MacMillan
<kieren@kierenmacmillan.info>:
>
> Hi David,
>
> > git grep list-head
> >
> > suggests woodwind diagrams, predefined fretboards, the function
> > offset-fret, the \parallelMusic construct as possible callers.
> >
> > Anything in that list?
>
> I doubt it…
>
> > If not, my guess would be some edition-engraver
> > code when taking into account your usual toolbox.
>
> I knew it couldn't be that, because I tried "shutting off" the EE in that
> score, and it still failed.
>
> But your suggestion helped me find one thing that may well be the issue: this
> score uses a "dynamics on the fly" function, and the ones that are working
> don't. Here's the function:
>
> custdyn =
> #(define-event-function (parser location idx strg)
> ((index? 1) string?)
> "Returns customized DynamicText derived from @var{strg}.
> Parts which should be rendered with as dynamics should be entered by
> surrounding them with the elements of @code{details.separator-pair}, default
> is
> @code{(cons #\\{ #\\})}.
> The output is done by using the procedures from
> @code{details.markup-commands},
> defaulting to @code{(cons make-dynamic-markup make-italic-markup)}.
> Further customizing is possible by using
> @code{details.dyn-rest-font-sizes}, needs a pair, default is unset
> @code{details.inner-x-space}, needs a pair, default is unset
> @code{details.outer-x-space}, needs a pair, default is is unset
> The optional @var{idx} determines which dynamic part is centered under the
> NoteColumn (in case @var{strg} contains multiple dynamics).
> "
> (let* ((dynamic (make-music 'AbsoluteDynamicEvent))
> (tweak-proc
> (lambda (grob)
> (let* (
> (separator-pair
> (assoc-get
> 'separator-pair
> (ly:grob-property grob 'details)
> (cons #\{ #\})))
> ;; get the fontsizes to use from the relevant
> ;; details-sub-property, i.e. 'dyn-rest-font-sizes
> (dyn-rest-font-sizes
> (assoc-get
> 'dyn-rest-font-sizes
> (ly:grob-property grob 'details)))
> ;; get the markup-commands to use from the relevant
> ;; details-sub-property, i.e. 'markup-commands, a pair
> ;; car for dynamic, cdr for the rest
> (markup-commands
> (assoc-get
> 'markup-commands
> (ly:grob-property grob 'details)
> (cons make-dynamic-markup make-italic-markup)))
> ;; get the pair-value to use for inserting some space to
> the
> ;; left and/or right of the dynamic, usefull for bracketed
> ;; dynamics or dynamics with punctuations
> (inner-kern
> (assoc-get
> 'inner-x-space
> (ly:grob-property grob 'details)))
> ;; get the pair-value to use for inserting some space
> ;; between the dynamic expression and other text.
> (outer-kern
> (assoc-get
> 'outer-x-space
> (ly:grob-property grob 'details)))
> (stil-candidates
> (dynamic-text::structered-list
> separator-pair
> dyn-rest-font-sizes
> inner-kern
> outer-kern
> markup-commands
> (1- idx)
> strg))
> (all-stils
> (map
> (lambda (mrkp)
> (if (null? mrkp)
> empty-stencil
> (grob-interpret-markup grob
> (if (markup-list? mrkp)
> (make-concat-markup mrkp)
> mrkp))))
> stil-candidates))
> (prev-self-alignment-X-tweaks
> (filter
> (lambda (tw)
> (eq? (car tw) 'self-alignment-X))
> (ly:prob-property
> (ly:grob-property grob 'cause)
> 'tweaks))))
>
> (begin
What happens if you follow the comments below? Cheers, Harm
> ;; Next line should be used for 2.19.65 and above
> ;(ly:grob-set-property! grob 'stencil
> ; (stack-stencils X RIGHT 0 all-stils))
> ;; This line is for 2.18.2, though sometimes the offset in
> x-axis
> ;; is a little off
> (ly:grob-set-property! grob 'text
> (make-stencil-markup (stack-stencils X RIGHT 0 all-stils)))
> ;; if previous tweak for self-alignment-X is present return '()
> (if (pair? prev-self-alignment-X-tweaks)
> '()
> (ly:grob-set-property! grob 'X-offset
> (let* ((x-exts
> (map
> (lambda (stil) (ly:stencil-extent stil X))
> (take all-stils 2)))
> (x-par (ly:grob-parent grob X))
> (parent-x-ext-center
> (interval-center
> (if (ly:grob-property grob
> 'X-align-on-main-noteheads)
> (note-column::main-extent x-par)
> (ly:grob-extent x-par x-par X))))
> ;; Get previous tweaks for X-offset and add their
> ;; values
> ;; They are added to the final result
> (prev-x-offset-tweaks
> (filter
> (lambda (tw)
> (and (number? (cdr tw))
> (eq? (car tw) 'X-offset)))
> (ly:prob-property
> (ly:grob-property grob 'cause)
> 'tweaks)))
> (prev-x-off
> (apply + (map cdr prev-x-offset-tweaks))))
> (if (markup-list? stil-candidates)
> ;; For text only or if idx is set zero: align
> center.
> ;; Also possible would be to left align, by
> switching
> ;; to zero.
> (ly:grob-property grob 'X-offset)
> ;
> (+
> prev-x-off
> (-
> parent-x-ext-center
> (interval-length (car x-exts))
> (/ (interval-length (second x-exts)) 2)
> (cond ((and (ly:stencil-empty? (car
> all-stils))
> (negative? (car (second x-exts))))
> (car (second x-exts)))
> ((negative? (car (first x-exts)))
> (car (first x-exts)))
> (else 0)))))))))))))
>
> (set! (ly:music-property dynamic 'tweaks)
> (acons 'before-line-breaking
> tweak-proc
> (ly:music-property dynamic 'tweaks)))
> dynamic))
>
> Anything there that could be the problem? (Not sure if I need to supply any
> other functions/code for diagnosis?)
>
> Thanks,
> Kieren.
- another 'wrong type argument' error, Kieren MacMillan, 2022/10/09
- Re: another 'wrong type argument' error, Jean Abou Samra, 2022/10/09
- Re: another 'wrong type argument' error, David Kastrup, 2022/10/09
- Re: another 'wrong type argument' error, Kieren MacMillan, 2022/10/09
- Re: another 'wrong type argument' error, David Kastrup, 2022/10/09
- Re: another 'wrong type argument' error, Jean Abou Samra, 2022/10/09
- Re: another 'wrong type argument' error, Jean Abou Samra, 2022/10/09
- Re: another 'wrong type argument' error, Kieren MacMillan, 2022/10/09
- Re: another 'wrong type argument' error, Jean Abou Samra, 2022/10/09
- Re: another 'wrong type argument' error, Kieren MacMillan, 2022/10/09
- Re: another 'wrong type argument' error, Jean Abou Samra, 2022/10/10
- Re: another 'wrong type argument' error, Jonas Hahnfeld, 2022/10/10