Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Font Info #114

Open
ajpizarro opened this issue May 24, 2017 · 6 comments
Open

Get Font Info #114

ajpizarro opened this issue May 24, 2017 · 6 comments

Comments

@ajpizarro
Copy link

ajpizarro commented May 24, 2017

I would like to get some info from the font files. I would like to get : copyright info, version, authors, if it can be embedded or not, license info, etc. Is it possible to get this data? Thanks in advance.

@HinTak
Copy link
Contributor

HinTak commented May 24, 2017

You don't need SharpFont for most of that. Except for the embedded permission, one of freetype's demo program, ftdump, does all of that if you run ftdump -n .... Don't know where the embedded bit is stored off the top of my head, but it is easy enough to look it up if you need to know.

Of course you can rewrite ftdump in C# if you insist. The freetype-py people wrote a python-based version.

@HinTak
Copy link
Contributor

HinTak commented May 24, 2017

Also font validator's report (https://github.com/Microsoft/Font-Validator) includes most of that info too. My substantial fork of it uses SharpFont to interact with freetype, but the font parser itself is pure C# and independent of freetype. It might be more suitable to your needs if you want a pure C# answer, instead of SharpFont, which is really pivoting into a platform c-based library.

@Robmaister
Copy link
Owner

ftdump appears to be pulling the copyright, authors, etc from FT_Get_Sfnt_Name, which is certainly available from within SharpFont (Face.GetSfntName).

Following ftdump as a guide is probably a good idea here. Relevant bit (Print_Sfnt_Names) is on line 257 of ftdump.c of the latest ft2demos release (2.8).

@HinTak it sounds like @Antoniotony is more asking where within FreeType/SharpFont that functionality is available so that the same data can be retrieved from within C# without needing anything else installed (can't run ftdump on iOS, for example).

@HinTak
Copy link
Contributor

HinTak commented May 24, 2017

I think pinvoke on IOS is tricky also. In any case, Microsoft's font validator has all the functionamity for reading sfnt tables implemented in C#, without pinvoke. (the proprietary 1.0 /1.1 uses mixed mode assemblies for the part that I use SharpFont/freetype in 2.0). Most of the requested info are in the analysis report output.

If you can pinvoke, the easiest thing is perhaps stuffing the whole of ftdump + freetype into a dll, and just pinvoke ftdump's main()!

@HinTak
Copy link
Contributor

HinTak commented May 24, 2017 via email

@ajpizarro
Copy link
Author

I'm sorry I did not answer before but i couldn't.
I'll give it a try and i would let you know.
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants