[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attaching an alist to a grob
From: |
Paul Morris |
Subject: |
Re: Attaching an alist to a grob |
Date: |
Tue, 13 Jan 2015 12:45:31 -0700 (MST) |
Urs Liska wrote
> So does anyone have an idea how I can attach an alist to a grob so that
> an engraver can retrieve it?
> Is it for example possible to add an arbitrary property to a grob?
Hi Urs, I've had good luck creating custom grob properties, which sounds
like what you're looking for. Here's how I do it, with some example custom
properties that I use:
%% CUSTOM GROB PROPERTIES
%% I use "cn-" to keep my functions separate from standard
%% LilyPond functions (like a poor man's namespace).
% function from "scm/define-grob-properties.scm" (modified)
#(define (cn-define-grob-property symbol type?)
(set-object-property! symbol 'backend-type? type?)
(set-object-property! symbol 'backend-doc "custom grob property")
symbol)
#(cn-define-grob-property 'cn-is-clairnote-staff boolean?)
#(cn-define-grob-property 'cn-vscale-staff number?)
Once they are defined I can use the custom properties with any grob (e.g.
StaffSymbol):
\override StaffSymbol.cn-is-clairnote-staff = ##t
\override StaffSymbol.cn-vscale-staff = #1.2
I suppose for an alist you would just use list? as the type predicate (or
maybe there's one for alists?).
Cheers,
-Paul
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Attaching-an-alist-to-a-grob-tp170412p170416.html
Sent from the User mailing list archive at Nabble.com.