lilypond-devel
[Top][All Lists]
Advanced

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

RE: Fret Diagram markup


From: Han-Wen Nienhuys
Subject: RE: Fret Diagram markup
Date: Wed, 26 May 2004 18:20:17 +0200

address@hidden writes:
> > to a Scheme list. 
> > 
> >  * The diagram items include settings for linethickness, height,
> >    width, etc.
> > 
> >    It would be better style to put these settings into properties, so
> >    you could do
> > 
> >        \translator { \StaffContext
> >          \override FretDiagram #'thickness = #0.2
> >        }
> > 
> >    and change all fret diagrams in one fell swoop.
> > 
> >    The properties delivered to the markup command through the props
> >    argument (which is a list of alists)
> 
> So do I assume that props is provided by the context, and that I can
> just get the value out of props with appropriate (assoc * ) calls?

Use the chain-assoc-get function (lily.scm) to extract values from the
alist chain. You can pass a default to this function, so you can still
set defaults from the Scheme function.

> Can
> you give me some suggestions as to where I'd go to find good examples of
> working with props?

Look at define-markups.scm

> >  * for multi-choice alternatives, such as
> > 
> >          f:number -- set fingering label type (0 = none, 1 = in circle
> >                   on string, 2 = below string) Default 0
> > 
> >    we use symbols instead of numbers. They are more descriptive.
> 
> Of course this is the best way.  Should I define a symbol to a numeric
> value, like in translate-stencil (X = 0, Y = 1), or is it better to just
> have the code say (if eq? markingcode below)?


yes,  ie.

  (if (eq? markingcode 'below) .. )

> >  * for alists, we generally use symbols, not strings as keys.
> 
> So instead of having an alist entry be ("thickness" 0.5)  it would be
> (thickness 0.5)?

yes. or rather:

  (thickness . 0.5)

> >  * It would be nice if the width of a diagram were computed, from the
> >    length of the stringTunings property.
> 
> And I assume I get stringTunings I get that from an alist in the props?

No, it's a context property, and must be retrieved from within an
enrgaver. That's another reason to build a Fret_diagram_engraver.

> >  * linethicknesses are generally expressed relative to the
> >    linethickness \paper variable. The default usually is 1.0
> 
> Is that also in the props?  If not, how do I get hold of it?

No, it's in the paper argument, something like

  (let*
   ((th (* (ly:paper-lookup paper 'linethickness)
           (chain-assoc-get 'thickness props 1.0)))
    ...

> > I should be grateful if you could address these issues.
> 
> I'll be happy to do it.  I'm sure I'll need some more guidance as I get
> into it, but I'll let you know.

OK, Good!


-- 

 Han-Wen Nienhuys   |   address@hidden   |   http://www.xs4all.nl/~hanwen 





reply via email to

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