SVG icon indicating copy to clipboard operation
SVG copied to clipboard

letter-spacing overlapping text when converting to png

Open cThePush opened this issue 1 year ago • 1 comments

Description

When converting to png and using a letter-spacing in a text the letters goes to the first position and overlap, like it has no space.

When removing the letter-spacing it works as intended.

Example data

In browser view(what is expected) image When converting to png: image

Code: SVG:

<text id="svg_18" x="32.267" y="664.62" letter-spacing="2px" font-size="48.9706px" font-weight="bold" font-family="Roboto" fill="{color}" class="st6 st12 st13 st14">{name}</text>
<text id="svg_19" x="32.267" y="723.38397" letter-spacing="2px" font-size="48.9706px" font-weight="bold" font-family="Roboto" fill="{color}" class="st6 st12 st13 st14">{surname}</text>

.NET:

var svgDocument = SvgDocument.Open(Path.GetTempPath()+image.ID+".bin");
var bitmap = svgDocument.Draw();
using (MemoryStream s = new MemoryStream()){
      bitmap.Save(s, ImageFormat.Png);
      byte[] byteImage = s.ToArray();
      Base64 = Convert.ToBase64String(byteImage); // Get Base64
}

Used Versions

Version Nuget, Windows Server 2019 and a I am using .NET Core

cThePush avatar Jan 17 '24 11:01 cThePush

@cThePush Please can you provide a complete sample SVG file for testing?

paulushub avatar Jan 25 '24 03:01 paulushub