lilypond-devel
[Top][All Lists]
Advanced

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

Re: Harp Pedals?


From: Carl D. Sorensen
Subject: Re: Harp Pedals?
Date: Sun, 17 Aug 2008 15:50:21 -0600



On 8/17/08 9:18 AM, "Reinhold Kainhofer" <address@hidden> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am Freitag, 15. August 2008 schrieb Reinhold Kainhofer:
>>> I haven't read all the code yet, but I do think you should check if
>>> the fourth character in the entry string is a pipe; that would make
>>> the users more comfortable.
>>
>> Okay, I can do this...
>
> Attached is a version, which adds some sanity checks (7 pedals, one divider
> after third diagram) and prints out warnings if they are violated, but still
> prints the diagram gracefully. Unfortunately, I don't know how to print the
> current position in the lilypond file so that the users can find which harp
> pedal call might be wrong.
> I also tried implementing circled pedals (\harp-pedal #"ov^-|o-v^-", where
> the "o" before a pedal indicates a circled pedal), but couldn't get it to
> work properly :(

>
> I'm having some issues, though:
>
> 1) It seems that the diagram has zero extent, so that it overlaps with the
> staff and other diagrams. How can I make the stencil (created by stencil-add)
> use the bounding box off all combined stencils?

I think you are not putting extents on your stencils when you create them.
In addition to the code necessary to create the stencil, the stencil should
have an x-extent (a pair (left-x . right-x)) and a y-extent (bottom-y .
top-y).  For example, if you look in draw-strings in scm/fret-diagrams.scm,
you'll see that ly:make-stencil takes a stencil list (list 'draw-line sth 0
0 0 sl) an x-extent (cons (- half-thickness) half-thickness), and a y-extent
(cons (- half-thickness) (+ sl half-thickness))

Each of your stencils needs an extent, or else the extent is zero.
Add-stencil combines the extents of all the stencils it adds.

>
> 2) How can I draw an ellipse around an object in lilypond? I only cound find
> (circle-stencil stencil linewidth padding)... However, this places the circle
> always at the horizontal line, even if the box stencil is placed
> higher/lower. Furthermore its radius is too small to surround the box. And of
> course, I don't want a circle but rather a vertical ellipse. See the last
> diagram in the .ly file...

circle-stencil will work if the extent of the stencil is correct. -- but it
will be a circle.

Based on circle-stencil, you can define an outline-ellipse-stencil function.

This will need to be done with a function in the back-end.  There is a
postscript procedure to draw ellipses, and you'll call it.  You'll need to
put a ps function in scm/output-ps.scm, and an svg function in
scm/output-svg.scm.  I guess we're still supporting the tex backend, even
though it's deprecated.  To do this you'll need to add an embedded-ps
function in scm/output-tex.scm.

Both ps and svg have ellipse functions.

>
> 3) To make it more customizable, I'd like the user to be able to tweak the
> linethickness, the spacing between the boxes, the box offsets and the box
> width/heights. What's the proper way to do this?

You should already have these coded in as variables.  Now you just need to
get them from the calling string.

In fret-diagrams, I started out by adding a bunch of properties, because
there are lots of things to vary in a fret diagram.  Han-Wen was concerned
about the pollution of the LilyPond namespace with lots of variables that
only had application to fret diagrams.  We solved this issue by putting
all of the properties into a single property fret-diagram-details.

Given the uniqueness of harp pedal diagrams, I think it would make sense to
define a property harp-pedal-details that would be a place to stash all the
harp-pedal-specific properties.

You get values out of the props argument to the markup function, using the
procedure chain-assoc-get.  Look in scm/fret-diagrams.scm for the patterns
to do this.

If you want to use harp-pedal-details, you'll want to look at "details" in
scm/fret-diagrams.scm.



I'm impressed -- keep up the great work!

Carl





reply via email to

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