Perfect. Thanks, Harm!

- Abraham

Sent from my iPhone

> On Jan 20, 2015, at 3:01 PM, Thomas Morley-2 [via Lilypond] 
> <ml-node+s1069038n170811...@n5.nabble.com> wrote:
> 
> 2015-01-20 22:49 GMT+01:00 Thomas Morley <[hidden email]>:
> 
> > 2015-01-20 22:30 GMT+01:00 tisimst <[hidden email]>: 
> >> Is it possible to derive the correct default print function for a grob? 
> >> 
> >> For example, if I want to get the stencil of a hairpin, I know the 
> >> function 
> >> is called "ly:hairpin::print", but for accidentals, it's 
> >> "ly:accidental-interface:print". 
> >> 
> >> I'd like to be able to get the right one automatically (in scheme) without 
> >> needing to specify them all and use conditionals to figure out the right 
> >> one. Any suggestions? I'm not sure if this is even possible, and I can 
> >> deal 
> >> with it if it's not, but I'd rather not if I can help it. 
> >> 
> >> Thanks, 
> >> Abraham 
> > 
> > Hi Abraham, 
> > 
> > it's not that hard ;) 
> > Though, one Problem might be a previous applied stencil-override... 
> > 
> > The code below will return the name of the default and the actual 
> > print-procedure. 
> > 
> > \version "2.19.15" 
> > 
> > #(define new-stil 
> >   (lambda (grob) 
> >     (grob-interpret-markup grob "xy"))) 
> > 
> > { 
> >     \override NoteHead.stencil = #new-stil 
> >     \override NoteHead.after-line-breaking = 
> >     #(lambda (grob) 
> >       (display "\nactual-stencil:\t\t") 
> >       (display 
> >         (procedure-name 
> >           (assoc-get 'stencil 
> >             (ly:grob-basic-properties grob)))) 
> >       (display "\ndefault-stencil:\t") 
> >       (display 
> >         (procedure-name 
> >           (assoc-get 'stencil 
> >             (reverse (ly:grob-basic-properties grob))))) 
> >       ) 
> >     c''1 
> > } 
> > 
> > HTH, 
> >   Harm
> 
> Maybe better to do some more afford, to return useful output, if it's 
> applied to a grob without 'stencil property 
> 
> #(define new-stil 
>   (lambda (grob) 
>     (grob-interpret-markup grob "xy"))) 
> 
> { 
>     \override NoteHead.stencil = #new-stil 
>     \override NoteHead.after-line-breaking = 
>     #(lambda (grob) 
>       (display "\nactual-stencil:\t\t") 
>       (display 
>         (let ((actual-stil-proc 
>                 (assoc-get 'stencil 
>                   (ly:grob-basic-properties grob)))) 
>           (if (procedure? actual-stil-proc) 
>               (procedure-name actual-stil-proc) 
>               (format #f "no stencil found for ~a" grob)))) 
>       (display "\ndefault-stencil:\t") 
>       (display 
>         (let ((default-stil-proc 
>                 (assoc-get 'stencil 
>                   (reverse (ly:grob-basic-properties grob))))) 
>           (if (procedure? default-stil-proc) 
>               (procedure-name default-stil-proc) 
>               (format #f "no stencil found for ~a" grob))))) 
> 
>     c''1 
> } 
> 
> Cheers, 
>  Harm 
> 
> _______________________________________________ 
> lilypond-user mailing list 
> [hidden email] 
> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://lilypond.1069038.n5.nabble.com/Derive-the-correct-print-function-of-a-grob-tp170809p170811.html
> To start a new topic under User, email ml-node+s1069038n...@n5.nabble.com 
> To unsubscribe from Lilypond, click here.
> NAML




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Derive-the-correct-print-function-of-a-grob-tp170809p170850.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to