lilypond-user
[Top][All Lists]
Advanced

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

Re: Extracting symbol location


From: Lukas Tuggener
Subject: Re: Extracting symbol location
Date: Mon, 05 Jun 2017 13:42:40 +0000

Dear David, Dear lilypond users

I have used an adapted version (see grace.ly) of the script David gave me (see test-clefs-svg.ly) to extract the exact location of various symbols. I recently tried to add support for grace notes. 

The problem is, when i look at the output of (ly:grob-properties grob) i see no reliable difference between a normal notehead and a notehead of a grace note. The only thing is the size of the notehead and i assume using this will be very unreliable due to different scalings.

Does anyone have a idea how to work around that?

Thanks a lot, best
Lukas


Output:

Normal Note:

<g id="NoteHead_((id . calculation-in-progress) (extra-spacing-height 0.0 . 0.954996) (stem-attachment 1.0 . 0.341476392833814) (Y-extent -0.545004 . 0.545004) (font . #<Font_metric ("emmentaler-20" . 0.569055118110236)>) (duration-log . 2) (stencil . #<Stencil>) (staff-position . -9) (cause . #<Prob: Stream_event C++: Stream_event((music-cause . #<Prob: Music C++: Music((length . #<Mom 1/16>) (duration . #<Duration 16 >) (pitch . #<Pitch g >) (origin . #<location mordent.ly:114:20>))((display-methods #<procedure #f (note)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types event note-event rhythmic-event melodic-event)) >
) (length . #<Mom 1/16>))((class note-event melodic-event rhythmic-event music-event StreamEvent) (length . #<Mom 1/16>) (duration . #<Duration 16 >) (pitch . #<Pitch g >) (origin . #<location mordent.ly:114:20>)) >
) (horizontal-skylines . #<unpure-pure-container #<primitive-procedure ly:grob::simple-horizontal-skylines-from-extents> #<primitive-procedure ly:grob::pure-simple-horizontal-skylines-from-extents> >) (vertical-skylines . #<Skyline_pair>) (X-extent -0.0 . 1.304212))[Duration 16 ]">
<a style="color:inherit;" xlink:href="">
<path transform="translate(32.6651, 12.1213) scale(0.0040, -0.0040)" d="M218 136c55 0 108 -28 108 -89c0 -71 -55 -121 -102 -149c-35 -21 -75 -34 -116 -34c-55 0 -108 28 -108 89c0 71 55 121 102 149c35 21 75 34 116 34z" fill="currentColor"/>
</a>
</g>



Small Note:

<g id="NoteHead_((id . calculation-in-progress) (extra-spacing-height 0.0 . 0.605960495541901) (stem-attachment 1.0 . 0.290370069546677) (Y-extent -0.394039504458099 . 0.394039504458099) (font . #<Font_metric ("emmentaler-14" . 0.569141064900509)>) (duration-log . 2) (stencil . #<Stencil>) (staff-position . -8) (cause . #<Prob: Stream_event C++: Stream_event((music-cause . #<Prob: Music C++: Music((length . #<Mom 1/8>) (duration . #<Duration 8 >) (pitch . #<Pitch a >) (origin . #<location mordent.ly:114:17>))((display-methods #<procedure #f (note)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types event note-event rhythmic-event melodic-event)) >
) (length . #<Mom 1/8>))((class note-event melodic-event rhythmic-event music-event StreamEvent) (length . #<Mom 1/8>) (duration . #<Duration 8 >) (pitch . #<Pitch a >) (origin . #<location mordent.ly:114:17>)) >
) (horizontal-skylines . #<unpure-pure-container #<primitive-procedure ly:grob::simple-horizontal-skylines-from-extents> #<primitive-procedure ly:grob::pure-simple-horizontal-skylines-from-extents> >) (vertical-skylines . #<Skyline_pair>) (X-extent -0.0 . 0.917888611646328))[Duration 8 ]">
<a style="color:inherit;" xlink:href="">
<path transform="translate(30.6680, 11.6213) scale(0.0028, -0.0028)" d="M208 139c61 0 117 -33 117 -99c0 -71 -52 -119 -99 -147c-34 -20 -71 -32 -110 -32c-61 0 -116 33 -116 99c0 71 51 119 98 147c34 20 71 32 110 32z" fill="currentColor"/>
</a>
</g>

Lukas Tuggener <address@hidden> schrieb am Mo., 16. Jan. 2017 um 15:36 Uhr:
Hi David,
thanks a lot for the update, it really helped me out greatly.

Thanks
Lukas

David Nalesnik <address@hidden> schrieb am Mo., 9. Jan. 2017 um 16:11 Uhr:
Lukas,

On Mon, Jan 9, 2017 at 8:43 AM, David Nalesnik <address@hidden> wrote:

> The new output-attibutes property allows you to create multiple
> attributes, so why not adapt the labeling routines to return something
> like
>
> value of output-attributes = '((name . someGrob) (moment . whenIAm)
> (x-pos . xCoordinate) (y-pos . yCoordinate))

A way to do this is attached.

An excerpt from the SVG:

<g name="StaffSymbol" when="[Mom 0]" x-pos="8.53582677165354" y-pos="-7.552">

-David

Attachment: test-clefs-svg.ly
Description: Text Data

Attachment: grace.ly
Description: Text Data


reply via email to

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