C#SVG渲染引擎 - 不转换PostScript字体但TrueType字体转换?

时间:2016-12-31 13:16:46

标签: c# svg fonts true-type-fonts postscript

我对C#的NuGet包SVG渲染引擎有问题。

我创建了2个自己的字体。第一个字体名称是PostScript(具有PostScrypt行),第二个字体名称是TrueType(具有TrupeType行)。 IMG Font informations

我做程序将我的SVG代码转换为位图图像并显示给他。 当我转换它,然后我得到这个:IMG Result of conversion

TrueType字体转换成功但PostScript字体没有。 我不知道我能做些什么。请帮忙。

有我的C#代码:

using System;
using System.Windows;
using System.Diagnostics;
using System.Timers;
using System.IO;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Xml;
using System.Windows.Media.Imaging;

namespace Test_Wpf
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            richTextBox.SelectAll();
            string svg = richTextBox.Selection.Text;

            try
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(svg);

                Svg.SvgDocument svgdoc = Svg.SvgDocument.Open(xmldoc);

                Bitmap bmp = svgdoc.Draw();

                MemoryStream ms = new MemoryStream();
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

                BitmapImage bim = new BitmapImage();
                bim.BeginInit();
                bim.StreamSource = ms;
                bim.EndInit();
                bim.Freeze();

                image.Source = bim;

                ShowMsg("Successfully converted. No Errors.");
            }
            catch(Exception ex)
            {
                ShowMsg(ex.Message);
            }
        }

        private void ShowMsg(string msg)
        {
            label.Content = String.Format("[{0}] - {1}", DateTime.Now.ToString(), msg);
        }
    }
}

0 个答案:

没有答案
相关问题