简体   繁体   English

如何从.Net Core中的ttf文件获取字体名称

[英]How to get the font name from a ttf file in .Net Core

I am trying to migrate my MVC 6 project to .NET Core 2.0 and we all know that lots of things are missing or is still in the development phase. 我试图将我的MVC 6项目迁移到.NET Core 2.0,我们都知道很多东西遗失或仍处于开发阶段。

I have a fonts folder containaing a number of .ttf files. 我有一个包含多个.ttf文件的字体文件夹。 My objective here is to retrieve all the Font Family Names from those ttf files. 我的目的是从这些ttf文件中检索所有字体系列名称

Previously, I was using the PrivateFontCollection under the System.Drawing.Text namespace . 以前,我在System.Drawing.Text命名空间下使用PrivateFontCollection The code was something like the answer to this post . 该代码是类似的答案, 这个帖子

But it is not working in .NET Core. 但是它不能在.NET Core中工作。

Am I missing a dll reference or is there another way to do it in .NET Core. 我是否缺少DLL参考,或者在.NET Core中还有另一种方法可以做到这一点?

Here is a sample of what i really want : 这是我真正想要的样本: 在此处输入图片说明

Great!!! 大!!! It seems someone provided a mono implementation of System.Drawing. 似乎有人提供了System.Drawing的单声道实现。 CoreCompat.System.Drawing CoreCompat.System.Drawing

.Net Core >= 2.1 now supports System.Drawing.Common . .Net Core> = 2.1现在支持System.Drawing.Common This is a Microsoft supported library which includes PrivateFontCollection. 这是Microsoft支持的库,其中包括PrivateFontCollection。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM