[Top][All Lists]

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

relative coordinates of different note heads

From: Marc Hohl
Subject: relative coordinates of different note heads
Date: Wed, 01 Jul 2009 21:11:50 +0200
User-agent: Thunderbird (X11/20090608)


I'm forwarding this to -devel according to Carl's proposals.

David Stocker has written an overview of desired features for lilypond and I am trying to write some music functions as a preliminary step for the implemetation. For this, I need to know the x and y coordinates of two consecutive noteheads
to draw pointed slurs and bend arrows, respectively.
I have some postscript code already available, but I didn't manage to get the
coordinates I need to draw the stuff.

Any hints/help is gladly apprechiated.


-------- Original-Nachricht --------
Betreff:        Re: start [was: Re: Take 1]
Datum:  Wed, 1 Jul 2009 07:57:28 -0600
Von:    Carl D. Sorensen <address@hidden>
An:     Marc Hohl <address@hidden>


This question should be asked on the -devel list; somebody there will be
able to help you.


On 7/1/09 1:47 AM, "Marc Hohl" <address@hidden> wrote:

I agree that the syntax will eventually be important.  And if it's decided
to do the engraver and create the new syntax, it'll need to be thought
through carefully.

But it's seldom the best way to get *started*.
Ok. As I use MusiXTeX for guitar music, I defined the pointed slurs and the
bend arrows by use of postscript, so I think the code could be reused here.

For the pointed slurs, I need the coordinates of the noteheads
(i.e. the height and the distance) to calculate the three points needed.
The only coordinates I can get so far are the x- and y-extensions of the
note heads themselves. This is important for placing the edges of the slurs
properly, but I have no idea how to get coordinates relative to each other.

This is what I got so far:

\version "2.13.1"

#(define (check grob)
   (let* ((stencil (ly:note-head::print grob))
          (x-ext (ly:stencil-extent stencil X))
          (y-ext (ly:stencil-extent stencil Y)))
    (display x-ext)(display y-ext)(newline)

example = \relative c {
   \clef "G_8"
   c4 d e f

\layout {
  \context {
  \override NoteHead #'stencil = #check

\score { \example }

It shows the coordinates of the note heads on the display and draws them
as usual.

Any hints/help appreciated!

Thanks again for all your work.


reply via email to

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