列出Windows 10 Universal App中已安装的字体名称

编程入门 行业动态 更新时间:2024-10-28 14:26:21
本文介绍了列出Windows 10 Universal App中已安装的字体名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在用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中已安装的字体名称

本文发布于:2023-11-06 04:20:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字体   名称   Windows   App   Universal

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!