Skip to main content
Participant
June 3, 2014
Question

How to get the actual font name from a font file?

  • June 3, 2014
  • 1 reply
  • 567 views

Hi

I have only the font Path I have to get the font name from that path. Any idea how to get the actual font name?


Thanks,

This topic has been closed for replies.

1 reply

Dan_Korn
Inspiring
June 11, 2014

I would ask you these questions:

  1. Why do you need to do this?  What are you ultimately trying to accomplish?
  2. Are you really asking about the InDesign SDK?
  3. Do you really need to get the "name" of a font from an arbitrary file?  Or do you want information about a font installed on the system?  If so, what OS?
  4. Do you need to be able to handle any font format?
  5. Which font "name" do you mean?
  6. What language do you want the name in?

(1) It's not clear what you're trying to accomplish.  A bit more information about your ultimate goal would be helpful.

(2) This question is not at all specific to the InDesign SDK.  Are you really trying to do something in the context of an InDesign plug-in?  If so, you probably want to look at IID_IFONTFAMILY and the IFontFamily::GetFamilyName function.

(3) If you are asking more generally, Windows and Mac both have system API calls to get this information, although those tend to deal with installed system fonts, not with arbitrary font files per se.

Also, you can parse the name table from a True Type or Open Type font without using any system APIs; as True Type and Open Type are well-documented standards.  I would start by reading these:

The Naming Table

Font Names Table


(4) Although there are other standards, such as Type 1 (PostScript) fonts, and True Type Collection files and other formats, especially on Mac.

(5) Also, when you start down this road, you will quickly realize that your seemingly simple question is actually ambiguous, and that the answer is kind of complicated, because a font can have many names (a family name, a full font name, a style name, a PostScript name, etc.).

(6) And not only does a font have multiple names, it can have each of those names in multiple languages and encodings.

Any clarification would make this a better question.