lilypond 2.12 svg output to inkscape 0.47r22583

Asked by Gerard McConnell

Hello,
I am able to output a music manuscript from LilyPond 2.12.0 in svg format.
When I open this svg file in Inkscape I can then select individual elements with control-click.
I can continue to select elements with shift-control-click.
However what I need to be able to do is to drag around elements in order to
select a large number of them at once; this is not possible.

I know there is nothing wrong with Inkscape - what am I failing to understand
about the svg output from Lilypond? The entire manuscript object is identified as g1982,
which leads me to believe that the object is a group of some sort, though this is clearly
not a group in the sense of the Ctrl-G command, since Ctrl-U does not ungroup the
elements.
Thanks for any help,
Gerard

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
sas
Solved:
Last query:
Last reply:
Revision history for this message
su_v (suv-lp) said :
#1

Could you upload the file somewhere so that we can have a look at it? This could be caused by nested <svg> elements which are not fully supported by Inkscape and can't be un-grouped because they are not real groups - even though Inkscape says so in the status line (see for example bug #166327 “cannot ungroup <svg> child elements” <https://bugs.launchpad.net/inkscape/+bug/166327> and bug #167229 “Nested svg elements: bbox misplaced” <https://bugs.launchpad.net/inkscape/+bug/167229>).

You could try something along these steps:
1) create a new layer
2) enter the group 'g1982' as you did before
3) select all elements inside the 'pseudo-'group with 'Ctrl+A'
4) copy them with 'Ctrl+C'
5) change to your newly created layer
6) use 'Ctrl+Alt+V' to paste the copied elements in place
7) check if every elements got correctly pasted
8) then delete the original group 'g1982' you no longer need
9) work with the copied elements which should be fully accessible in Inkscape now.

Caveat: I tested this with a sample file attached to one above mentioned bug reports - I don't know how well that works for a more complex 'real-life' example ;-)

hope this helps, nevertheless, ~suv

Revision history for this message
Gerard McConnell (gerrymcc) said :
#2

Hello ~suv,
Many thanks for your reply. I tried what you suggested, but unfortunately I still can't select elements
by dragging. I've put the code at - http://sites.google.com/site/inkscapequestion
which I hope will allow you to examine it.
What you said about nested svg elements may have hit the mark. I noticed the following at lines 2824 thru 2827:

<g transform="scale(2.28448872284489, 2.28448872284489) ">
<!-- Page: 1/1 !-->
<g>
<g transform="translate(4.37734706, 2.18867353)">

As I see it, there are no closing tags for these until the end of the file. I may be wrong about that, of course.
However, if I'm correct, is there an edit I could do which will make the elements accessible by drag selection?

Thanks again,
Gerard

Revision history for this message
Best sas (sas-sas) said :
#3

You just need to ungroup twice. The topmost group is a group of one group, so when you ungroup it it may look like nothing has happened - but ungroup a second time and you will have 868 separate objects.

By the way, does this file really render correctly for you? I'm looking at it in Inkscape 0.47 under Windows XP, and all the notes are missing (except for their tails), because they use an SVG font.

Revision history for this message
Gerard McConnell (gerrymcc) said :
#4

sas,
Absolutely OUTSTANDING, many thanks! Now I can perform edits easily, it's brilliant.
Were you able to determine that ungrouping twice was required from information that
Inkscape provided somewhere?
The font that I use for correct rendering is the Emmentaler font which is used
by LilyPond; if you do any music typesetting LilyPond's printed output is exceptionally good.
LilyPond takes text input, so finding the syntax to move musical elements around a few
pixels can be difficult, but since svg output is an option, a LilyPond\Inkscape combination allows complex scores with all sorts of graphics to be created and edited easily. Inkscape and Lilypond
already seem so good it's hard to see how they can be improved, but the Lilypond developers have written that they've improved the svg output a lot for the next stable release (2.14).
Gerard

Revision history for this message
Gerard McConnell (gerrymcc) said :
#5

Thanks sas, that solved my question.

Revision history for this message
sas (sas-sas) said :
#6

> Were you able to determine that ungrouping twice was required
> from information that Inkscape provided somewhere?

Yes: when the group is selected the status bar describes it as "Group of 1 object". After ungrouping once, this changes to "Group of 868 objects".