LilyPond’s SVG output is, as of version 2.10.25, broken so that its outputted SVG files require some repair in order to be useful. This example assumes that you have an input file called lilyfile.ly. (For our purposes, lilyfile.ly looks like the above snippet. In reality, the input doesn’t matter; however, input files longer than a snippet’s worth cannot be feasibly used with this method.) It also assumes that you have some experience with the command line—on *nix or on OS X—and with Inkscape or a comparable SVG editor.
I will first give source listings for two files, and then explain how to use them.
s/font-family:Century/font-family:Century Schoolbook L/g
s/font-family:L/font-family:Century Schoolbook L/g
#!/bin/sh .../lilypond -bsvg -o /tmp/lilysvg $1.ly && sed -Ef .../fix.sed /tmp/ lilysvg.svg > $1.svg
(Be sure to replace “...” with the appropriate paths.)
The first step is to run your lilyfile.ly through lilysvg.sh: run sh lilysvg.sh lilyfile (being careful not to include the .ly of the filename).
Next, open the generated lilyfile.svg in Inkscape or another SVG editor. The document’s content is contained in one or two groups; “ungroup” these. Now, select each note head and accidental in the piece. Select “ungroup” and then “convert to path”. You may need to do this with symbols other than note heads and accidentals, but you cannot do it to certain symbols, such as staff lines, bar lines, note beams, and note stems. After you have so converted each of the symbols in your file, you should have a working SVG file.