Skip to content

Diverse problems with text alignment when rendering to EMF #1138

Open
@jbartlau

Description

@jbartlau

Description

When rendering the attached sample file to EMF (source: https://en.m.wikipedia.org/wiki/File:SVG_Test_TextAlign.svg), the result is not as expected in a number of ways. The expected result would be:

image

The actual result however is:

image

The code used to produce the EMF is stripped down to the max and uses all default values:

string emfTempPath = @"c:\temp\EMF_Test_TextAlign.emf";
var svg = SvgDocument.Open(@"c:\temp\SVG_Test_TextAlign.svg");

                
using (Graphics bufferGraphics = Graphics.FromHwndInternal(IntPtr.Zero))
{
    using (var metafile = new Metafile(emfTempPath, bufferGraphics.GetHdc()))
    {
        using (Graphics graphics = Graphics.FromImage(metafile))
        {
            svg.Draw(graphics);
        }
    }
}

Example data

Input SVG:
text-align.svg

Result file as EMF:
EMF_Test_TextAlign.zip

Used Versions

Reproduced with NuGet version 3.4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions