Ozesh
Ozesh

Reputation: 6964

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 : enter image description here

Upvotes: 1

Views: 2592

Answers (2)

Brian
Brian

Reputation: 38025

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

Upvotes: 0

Ozesh
Ozesh

Reputation: 6964

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

Upvotes: 2

Related Questions