[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: id's for svg elements
From: |
Mike Solomon |
Subject: |
Re: id's for svg elements |
Date: |
Sun, 27 Oct 2013 09:07:21 +0200 |
On Oct 27, 2013, at 12:57 AM, Bric <address@hidden> wrote:
> On 10/26/2013 04:15 AM, Mike Solomon wrote:
>> On Oct 26, 2013, at 10:51 AM, Bric <address@hidden> wrote:
>>
>> For example…
>>
>> \version "2.17.30"
>>
>> #(define (note-number grob)
>> (string-concatenate
>> (list
>> "NoteHead/"
>> (number->string
>> (ly:pitch-semitones
>> (ly:event-property (ly:grob-property grob 'cause) 'pitch))))))
>>
>> \relative c' {
>> \override NoteHead.id = #note-number
>> a
>> }
>>
>> Then
>>
>> lilypond -dbackend=svg yourfilename.ly
>>
>> Then open the SVG and look for id="NoteHead/-3"
>>
>> Cheers,
>> MS
> Hi! I see it. And I can see that you're doing some sort of awesome magic
> here, but it remains a total mystery... looking at the code, and looking at
> the result, alike.
>
> (what's a "grob property"? I guess it's time to hit the fine manual…)
>
Yeah, definitely hit the manuals - they explain in details what grob properties
are, how to access them, how to create callback functions, etc..
> I can see that your code above generates this in the resulting *.svg file:
>
> <g id="NoteHead/-3">
> <path transform="translate(24.1197, 21.1727) scale(0.0040, -0.0040)" d="M217
> 139c57 0 112 -31 112 -94c0 -72 -55 -121 -102 -149c-35 -21 -74 -35 -115
> -35c-57 0 -112 31 -112 94c0 72 55 121 102 149c35 21 74 35 115 35z"
> fill="currentColor"/>
> </g>
>
> but I have no idea why this is so, and why there's a group with only one
> member in it.
The code creates an encapsulating group around the note head. If you wanted to
do it with the stem, you'd create an override:
\override Stem
> I presume you are suggesting to group the notehead, the stem, and maybe
> accidentals, and what not, under the same group and group id?
>
To do this, you'd need to do:
\override NoteColumn
>
> thanks!
>
> (PS: how is it that you have 2.17.30, when the latest version is 2.17.29 ?
> http://download.linuxaudio.org/lilypond/source/v2.17/ )
>
>
I build LilyPond from source, and the current version in current master is
2.17.30.
Cheers,
MS
- id's for svg elements, Bric, 2013/10/26
- Re: id's for svg elements, Mike Solomon, 2013/10/26
- Re: id's for svg elements, Bric, 2013/10/26
- Re: id's for svg elements,
Mike Solomon <=
- Re: id's for svg elements, David Kastrup, 2013/10/27
- Re: id's for svg elements, Bric, 2013/10/27
- Re: id's for svg elements, David Kastrup, 2013/10/27
- Re: id's for svg elements, Henning Hraban Ramm, 2013/10/27
- Re: id's for svg elements, David Kastrup, 2013/10/27
- Re: id's for svg elements, Henning Hraban Ramm, 2013/10/27
- latest source (was Re: id's for svg elements), Bric, 2013/10/27
- Re: latest source (was Re: id's for svg elements), Urs Liska, 2013/10/27
- Re: latest source (was Re: id's for svg elements), David Kastrup, 2013/10/27