简体   繁体   中英

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.

I have a fonts folder containaing a number of .ttf files. My objective here is to retrieve all the Font Family Names from those ttf files.

Previously, I was using the PrivateFontCollection under the System.Drawing.Text namespace . The code was something like the answer to this post .

But it is not working in .NET Core.

Am I missing a dll reference or is there another way to do it in .NET Core.

Here is a sample of what i really want : 在此处输入图片说明

Great!!! It seems someone provided a mono implementation of System.Drawing. CoreCompat.System.Drawing

.Net Core >= 2.1 now supports System.Drawing.Common . This is a Microsoft supported library which includes PrivateFontCollection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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