Hello Paolo,
I’m not exactly sure what you mean by „inline-svg”. The discussion you linked
to is about manually converting svg paths into lilypond paths. While this is
possible it surely would get very complicated with more advanced svg.
But it should be quite easy to use the <image>-tag svg gives us by it’s
specifications to embed any sort of jpeg, png or svg image.
Hello Valentin,
In addition: how would I create the <image> tag with Lilypond? If I have to do manipulation on the svg file after it is created by LilyPond, then I would prefer inline svg, which means: nesting a <svg> tree inside another <svg> tree (<svg>...<svg></svg>...</svg>). Then I would avoid rasterization (and I would not have clashing ids, AFAIK). But I still prefer to do all on the LilyPond side, not after the output is created.
Let's consider my specific case. I have to put some measures with few notes as examples on the initial pages of the score. Something like this (+ staff lines and clefs):
I think the best solution is to convert svg paths to LP paths. I just found a very useful tool for Inkscape, which transforms SVG paths in a way that can be quite easily converted to LP paths:
Here is my (alfa) procedure:
1) create a snippet and save it as
snippet.ly. Compile it with SVG backend (output file: snippet.svg)
2) process snippet.svg with CLI of Inkscape (with the Klowner transform filter), so to convert all the objects to path (output file: snippet-paths-only, tested on Linux, Inkscape 1.1)
inkscape --batch-process --actions="select-all;ObjectFlipVertically;object-to-path;select-all:all;com.klowner.filter.apply_transform.noprefs;export-filename:snippet-paths-only.svg;export-do" snippet.svg
3) feed a script which translates snippets-path-only.svg to LilyPond syntax (output file:
snippet-to-markup.ly). I created a "svg-paths-to-ly-paths.py" script for this job:
First results are very promising, and I can already use this system for real cases. The size of the stems can be more accurate, but there's an easy fix for this: replacing the <rect> associated to the stem with a <line>, so to have a proper conversion of the object to a <path>.
I attach to this message all the files of my test.
Best,
P