I'm working on an Font Identification tool which runs natively on both Windows XP/7/Vista and Mac OS X and needs to perform high-speed quality rendering of Outline fonts.
As we needed high performance & multi-platform developing environment, we choose a Qt4 / C++ combination and we use freetype2 for font rendering. By the way, I'm really impressed from the stability, performance & code quality of the freetype2 library and I highly recommend it! When we switched from Qt4 internal font rendering to freetype2, the product performance increased by about 300% while the probability of an app-crash due to a bad font is lowered from 1:10.000 to 1:200.000.
Our product currently supports OpenType (OTF) and TrueType (TTF) fonts and we are about to add support for Postscript Type 1 (PS1) fonts.
In fact we have already added support for Windows Type-1 fonts but I have a real trouble to find the required information to handle Mac OS Type-1 fonts. You can see some platform-depended differences of Type-1 fonts here: http://www.asy.com/fonts.htm
On Windows, each Type-1 font is contained in 2 files: font-name.pfb (the font outlines) and font-name.pfm (the font metrics, kerning, etc)
To open a Type-1 font + metrics with freetype2 you can just do the following:
ftError = FT_New_Face(&ftLibrary, "font-name.pfb", ftFaceIndex, &ftFace);
if (ftError)
(...)
ftError = FT_Attach_File(ftFace, "font-name.pfm");
if (ftError)
(...)
I have the following issues/questions regarding Mac OS X:
1) Is there a corresponding *.pfm (metrics) file? and if the answer is yes, does it always exist on any given Mac-Type-1 font?
EDIT/Answer: There is no *.pfm file in Mac Type-1 fonts. The font-metrics are stored inside a bitmap font stored in the same Font-Suitcase. See the following link about transferring fonts between Windows & Mac, explaining many of the differences between Win-Type-1 and Mac-Type-1 fonts: http://www.macdisk.com/fontsen.php3
2) Is there a corresponding *.pfb (outlines) file? My info so far is that an outlines file exists and it has no extension (pfb) but a "Mac type" of LWFN. How I can read the "LWFN" type associated with a file while scanning for all such Type-1 files on a given directory? In general: How to handle Mac data/resource files and File-Types using Qt & C++ ?
3) Are those files (1),(2) exist always in the same directory?
EDIT/Answer: This question is no longer meaningful, after asnwer(1) [=there is no *.pfm file in Mac-Type-1 fonts].
4) If I know the filepaths of (1),(2) for a specific font, is it possible to install the font by just copying the files into User's font library folder (which is true for OTF/TTF fonts) or I have to use some other special installation method?
EDIT/Answer: The Mac-Type-1 fonts comes inside a Font-Suitcase. The correct installation method is to install the whole Suitcase to User's font library.
5) Is it possible to take a Windows-Type-1 font (pfb/pfm) and install/use it on a Mac OS X machine, without any conversion?
EDIT/Answer: The answer is NO. The pfb/pfm need conversion to be installed/used in Mac OS X but you can use them by Adobe applications like Photoshop/Indesign if you copy them to some special fonts folder of these Apps.
I will really appreciate any answers or links pointing to the right direction, because any search I have done so far, just points to another level of complexity without getting me any definite or useful answers.
Thanks
Fivos
PS: I tried to answer most of my questions, and I will also post a link to some pieces of code I have found.
I answered most of my questions by editing my original post. For future readers: I have found some piece of open-source C code which addresses the problem of handling Mac Font Suitcases and extracting OTF/TTF/Type-1 fonts from them.
It's a set of tools written by George Williams (see the description bellow). The link to open-source project: http://fondu.sourceforge.net/#Fondu
Fondu -- A set of programs to interconvert between mac font formats and pfb, ttf, otf and bdf files on unix.
Dealing with mac fonts is hard on other operating systems because mac fonts are stored in the resource fork, and other operating systems do not support this concept. Fondu will extract the resource fork from either a macbinary file or a binhex file. Ufond will create a resource fork inside a macbinary file.