ImageMagick SVG with Windows symbol font (private use unicode character)

144 Views Asked by At

I'm using MagickNet (ImageMagick for .NET) to read the SVG code below, which contains a valid character from the "Symbol" true type font on Windows. The character is UF0B7 (uniF0B7 in the cmap table of the symbol.ttf font). This is a filled circle. The image I get using ImageMagick contains a rectangle with F0B7 written inside.

Here is my SVG file containing this special character. It is inside the text XML element (you might see it as a small square on your browser):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="main1" width="960" height="720">
    <g transform="matrix(1.3333334 0 0 1.3333334 0 0)">
        <path stroke="none" fill="#FFFFFF" fill-rule="evenodd" d="M0 0L720 0L720 540L0 540z" transform="matrix(1 0 0 1 0 0)"  />
        <text style="fill:#000000;font-family:Symbol;" font-size="32" transform="matrix(1 0 0 1 43.08661 129.5433)" fill-opacity="1" x="0.028347015" y="29.952" letter-spacing="-0.01"></text>
    </g>
</svg>

Here is my C# code:

byte[] imageData = File.ReadAllBytes(@"F:\test.svg");
using MagickImage image = new MagickImage(imageData);
image.Write(@"F:\test.jpg");

Is there a way to make ImageMagick use the system's Symbol font with such private use characters (according to the unicode standard) ? This character and others of the same kind are often used by Powerpoint software for bullets. I need, in my own software, to convert pptx slides to svgs using available libraries, and then rework them, isolate paragraphs in separate SVGs, to produce slide animation. In order to convert the final SVGs to images, I could also use other libraries like SVG.Net, but this one has other problems too. Up to now, MagickNet is the most precise one, except for this problem.

0

There are 0 best solutions below