How can I obtain font properties thru a font file (*.otf;*.ttf or PostScript fonts)?

Recommended Answers

All 7 Replies

Will, I'd personally open 2 sample files for all three types in a hex editor, and see if I can find the propery values in them and try and find a pattern to where they are located. After that I would write a program to open the file up, index the those locations and extract the data. There also may be some kind of font api out there. Why not do a quick google search? Hey, look at the first result!

Hi, Hiroshe,

I am honestly thankful & grateful to your very--EXTRA--quick reply to my thread. I have actually done before what you are suggesting me. My code succeeded in some font files but it failed in other font files. Ain't there a standard font header structure that we can use to obtain the information we want? For example, there is a BITMAPFILEHEADER or BITMAPCOREHEADER for obtaining a bitmap information from a bitmap file.

If you are on MS-Windows why not just use win32 FONT structure and call win32 api functions to populate it. This might help you.

One request to you, while asking for any help reagarding coding
please mention the ENVIRONMENT and COMPILER you are using.]

Unless of couse your writting portible (and standard) code that should run on any compiler/OS. :)

Unless of couse your writting portible (and standard) code that should run on any compiler/OS. :)

But that's rarely the case, especially with newbe programs. And IMHO its always a good idea to mention them in any case.

commented: Can't argue with that +2

In Different environments different API's are there.
It's quite difficult to do read fonts and all core C.That's what i meant.

Basically we need to understand the file format.If we can get this this it's done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.