获取.net中的字体信息
我想知道是否有人知道如何以编程方式从 true type 字体中获取版本和版权详细信息等信息。如果您在资源管理器中打开它以及预览,您将在 Windows 字体查看器中获得此信息。我查看了 Logfont 结构,但信息似乎不在这里,
干杯 卢克
I was wondering if anyone knows how to programatically get things like the version and copyright details out of a true type font. If you open it in explorer as well as the preview you get this info in the windows font viewer. I've looked at the Logfont structure but the info doesn't seem to be in here
Cheers
Luke
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几年前我为了一个工作项目不得不这样做。我无法发布此内容,因为它是专有的,但 TT 字体的规范位于此处。
我为偏移表、名称记录、名称表头和表目录元素编写了类,以便每个类都有一个静态 FromStream 方法。
我还编写了一个名为 BigEndianReader 的实用程序类来处理从大端有序流中读取数据,我很高兴将其放在这里以使您的生活更轻松:
这不是特别优雅,但它很容易使用:
我想如果您足够关心,您可以在 Stream 上创建所有扩展方法,然后您可以阅读:
I had to do this a couple years ago for a work project. I can't post this as it's proprietary, but the spec for TT fonts is here.
I wrote classes for offset table, name record, name table header, and table directory elements such that each class had a static FromStream method.
I also wrote a utility class called BigEndianReader to handle reading data in from a big endian ordered stream, which I'm happy to put here to make your life easier:
This is not especially elegant, but it's easy enough to use:
I imagine that if you cared enough you could make this all extension methods on Stream and then your could would read: