[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: |
Sat, 26 Oct 2013 11:15:32 +0300 |
On Oct 26, 2013, at 10:51 AM, Bric <address@hidden> wrote:
> can someone help scope out the task of adding semantically sound unique
> identifiers to the svg elements?
>
> Such that the id bears info on, at least, the staff, (maybe bar), and
> note/chord index (consecutive integer index, for instance)
>
> the "output-svg.scm" script has various routines to build the svg
> elements/tags/attributes, and these are implemented by other scm scripts
> (e.g., "round-filled-box")...
>
> Before I spend hours (days?) trying to figure out the precise subroutine
> chain/tree , perhaps someone can lead me directly to the top-level code that
> feeds lilypond info into these scripts? And whereby one can feed
> staff/movement info, along with note index down to the final svg output?
>
> And is this a realistic goal, I wonder? I think even just identifying CLASS
> information in the "id=..." attribute might help. Just to set the stem "rect"
> apart from the staff line "rect", for instance, would already be an
> improvement; but, of course, I prefer even more specifics, as I described
> above.
>
> thanks.
>
There is a grob property that is called "id" that is called far downstream
(right when the backends are getting the last information about the grobs
before drawing them). That means that, if you create a callback for this
property, you can feed it all sorts of info. The resulting SVG object will be
wrapped in a group with this id.
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
- id's for svg elements, Bric, 2013/10/26
- Re: id's for svg elements,
Mike Solomon <=
- Re: id's for svg elements, Bric, 2013/10/26
- Re: id's for svg elements, Mike Solomon, 2013/10/27
- 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