我正在用C#构建Windows 10通用应用程序,该应用程序必须列出系统上已安装字体的名称.该应用程序是Metro/Modern ui/windows 8.1应用程序,我使用了那里的SharpDX把戏" 以获取名称.
I am building a Windows 10 universal app in C# that has to list the names of the installed fonts on the system. The app was a metro/modern ui/windows 8.1 app and I used the SharpDX 'trick' there to get the names.
SharpDX在Windows 10 UAP上不可用(尚未?),因此不再起作用.
SharpDX is not available (yet?) for Windows 10 UAP, so that does not work anymore.
还有其他方法可以实现我的目标吗?我是否应该按照此处在推荐字体下?例如,在台式机上时,这似乎是一种限制.
Any other ways to achieve my goal? Should I consider a fixed list of font names as described here under recommended fonts? This seems rather limiting when on a desktop for instance.
提前谢谢!
推荐答案相同的基本思想:您仍将使用DirectWrite来获取字体名称.
Same basic idea: you'll still use DirectWrite to get the font names.
您可以在Windows 8.1和通用Windows平台应用程序中使用 Win2D 从C#转到DirectWrite..CanvasTextFormat. GetSystemFontFamilies 将返回字体系列:
You can use Win2D to get to DirectWrite from C# in both Windows 8.1 and Universal Windows Platform apps. CanvasTextFormat.GetSystemFontFamilies will return the font families:
string[] fonts = Microsoft.Graphics.Canvas.Text.CanvasTextFormat.GetSystemFontFamilies(); foreach (string font in fonts) { Debug.WriteLine(string.Format("Font: {0}", font)); }更多推荐
列出Windows 10 Universal App中已安装的字体名称
发布评论