WPF Can't Find some Fonts

别来无恙 提交于 2019-12-24 21:22:35

问题


Why is it that Media.Fonts can't find "Arial Rounded MT Bold"?

foreach (var f in System.Windows.Media.Fonts.SystemFontFamilies)
{
    if (f.Source == "Arial Rounded MT Bold")
    {
        var x = "Not Found";
    }
}

var fc = new System.Drawing.Text.InstalledFontCollection();
foreach (var fd in fc.Families)
{
    if (fd.Name == "Arial Rounded MT Bold")
    {
        var x = "Found";
    }
}

回答1:


Check in your system's Windows folder. Do u have "Arial Rounded MT Bold" font installed on your system?? You might not have the font installed on your system.. That might be the only issue for not finding it..

Ok, i got it in first loop you are looping through System Font families and for "Arial Rounded MT Bold" its font family is "Arial Rounded MT". You can check about its specification here - http://www.microsoft.com/typography/fonts/font.aspx?FMID=918

So, if you update your code like this -

foreach (var f in System.Windows.Media.Fonts.SystemFontFamilies)
{
      if (f.Source == "Arial Rounded MT")
      {
         var x = "Found";
      }
}

You will get that font which you are looking for..



来源:https://stackoverflow.com/questions/5683921/wpf-cant-find-some-fonts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!