Hello!

I use lilypond with the "-dbackend=svg" option. The text in the
resulting SVG files looks very different depending on the browser used
to render it. This concerns text elements with a mix of normal and
italic text, for example:

step of _terza minore_

('terza minore' in italics)

On most browsers there is a large gap between 'of' and 'terza'. I noticed
that lilypond exports such a situation as individual <text> elements
with absolute coordinates (as in <g transform=...>).

Is there a way to let lilypond combine these words into a single <text>
element, using <tspan> elements to define the formatting? Below I
include an excerpts of an original SVG file and a solution that would
solve the problem.

Thank you!

Johannes



Lilypond source:

\left-align { \concat { \normal-text "step of " \italic "terza minore" } }


Original Lilypond export:

<g transform="translate(7.0134, 14.5209)">
<text font-family="serif" font-size="2.2001" text-anchor="start" 
fill="currentColor">
<tspan>step of </tspan>
</text>
</g>

<g transform="translate(14.5591, 14.5209)">
<text font-family="serif" font-style="italic" font-size="2.2001" 
text-anchor="start" fill="currentColor">
<tspan>terza minore</tspan>
</text>
</g>


Solution:

<g transform="translate(7.0134, 14.5209)">
<text font-family="serif" font-size="2.2001" text-anchor="start" 
fill="currentColor">
step of <tspan font-style="italic">terza minore</tspan>
</text>
</g>

Reply via email to