ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How to know font index in Mac OS X HelveticaNeue.dfont file
Posted by Mac OS X HelveticaNeue.dfont: how to know font index on Dec-07-2012 03:10
Hi,

It looks that different Mac OS X versions have different font index. How to know the index
of a font and how to make them the same index?

Thanks,
Jinyan

  Re: How to know font index in Mac OS X HelveticaNeue.dfont file
Posted by Peter Kwan on Dec-08-2012 01:11
Hi,

The easiest method I can think of is just to test the various indexes to see which one corresponds to which style.

I am not sure if the dfont indexes change for certain fonts among different Mac OS X versions. In the fonts used in the ChartDirector sample code, the indexes 0, 1, 2, 3 refer to "regular", "bold", "italic" and "bold italic". ChartDirector maintains an internal table that can translate certain fonts into the font file name + index (eg. "arialbd.ttf" on Windows is translated to "Arial" with index = 1).

In recent versions of Mac OS X, I believe most of the dfonts are obsoleled and replaced with true type fonts (ttf or ttc). For instance, I think "Helvetica Neue" is no longer available as a dfont since Mac OS X 10.6. So if you need to support these types of font, you may consider to buiid a table that mapped older Mac OS X fonts to newer fonts.

The only method I know of which can programmatically obtain the font index is to use the Mac OS X Operating System API. Many years ago we used to have some code that used the Mac OS X Font Manager API to determine the font file name and index, given the font family name and style. However, since the Mac OS X Font system shuts down if no one has logged in and the Mac OS X GUI is not running, it means the code would not work in a background application (such as in a web server, batch job, ...). That's why we have not included such code in ChartDirector.

Regards
Peter Kwan