macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Font Management in Mac OS X -- Part 2

by Peter Fraterdeus
08/21/2001

In my last article, I mentioned that there are two major font technologies supported by OS X: True Type and Postscript. Of course, anything having to do with fonts is bound to be more complicated than that. Each font is made up of a minimum of two components: the glyph outlines, and the metrics data.

A little background information about Mac fonts

Glyph is the word used to describe any unique shape rendered by a type system, which can, in the case of ligatures, represent more than one "character" in the text stream. In computer typography, glyph outlines are the actual "programs" that define the shape of the complex TrueType or Type 1/Postscript spline curves, which when they are calculated and filled with pixels, create an actual visual glyph or character.

Metric data is used to establish the width of the character and the "sidebearings," or placement of the glyph horizontally within that width. In Postscript fonts, this data is supplied either in an ATM (Adobe Type Metric) file, or on the Mac, in the NFNT resource (also known as a font suitcase). TrueType format includes both the metrics and the outline data in a single file, as will OpenType.

High Class Fonts for Mac OS X

The outlines that Apple has licensed for OS X from Linotype, Carter & Cone, and others are top-quality professional faces, which are the foundation of a very fine type library.

The Didot is a gorgeous face. The font has a bit of interesting history:

... The Didot family were active as designers for about 100 years in the 18th and 19th centuries. They were printers, publishers, typeface designers, inventors and intellectuals. Around 1800 the Didot family owned the most important print shop and font foundry in France. Pierre Didot, the printer, published a document with the typefaces of his brother, Firmin Didot, the typeface designer. The strong clear forms of this alphabet display objective, rational characteristics and are representative of the time and philosophy of the Enlightenment. Adrian Frutiger's Didot is a sensitive interpretation of the French Modern Face Didot. Another model for this design is the Henriade, a historical printing of the original Didot from 1818. The font Didot gives text a classic and elegant feel.
Copyright (c) Linotype Library GmbH

Apple has released a tech note that details the font technologies and data formats supported by Mac OS X. According to the note, Windows TrueType TTF format is supported, along with the legacy Mac Suitcase for TrueType and SFNT Suitcases, which are used with Type 1 Postscript outlines (LWFN, or "Laserwriter Fonts"). Postscript OpenType fonts are natively supported by the new OS as well, and as Adobe and other application makers create Mac OS X native apps, the end user may begin to see some of the features and benefits of the OpenType technology.

Note that PostScript Type 1 Multiple Master fonts are not yet supported on Mac OS X. As Adobe has stopped making Multiple Master fonts, I'm not optimistic about support for this format. I do hope, however, that we will see support for OpenType "variations," which is Multiple Masters done right in the first place. However, this, again, requires that the application publishers provide an interface to the features. It's a chicken and egg problem, since without the apps, there's no incentive for font developers to produce fonts with these features.

Introduction of the .dfont format

A point of confusion for those of us familiar with previous Mac font formats was the introduction of the .dfont format. Apple's tech note says:

The contents of the .dfont file format used with all the standard TrueType system fonts on Mac OS X are identical to the standard font suitcase files, except that the font resources are stored in the data fork of the file. On Mac OS X, the 'FONT' bitmapped font resources are not supported, although the 'NFNT' bitmapped font resources are supported for Quickdraw applications. Font families consisting entirely of 'NFNT' bitmapped font resources are ignored by non-Quickdraw applications based on Cocoa, Apple Type Services for UnicodeTM Imaging (ATSUI), and Multilingual Text Editor (MLTE), and cannot be applied to user interface elements such as menus, windows, and static and editable text controls.

Font developers have been advised by Apple that .dfont is an Apple-only format, developed for reasons relating to the system building process, and that there is no need for others to produce or provide fonts in this format.

More on font management

In the process of developing the technique I described in my last article (using BSD links to manage fonts), I discovered that this procedure produces some inconsistent behaviors. For instance, I found that the fonts installed in this way would work perfectly in some cases and not in others. I've been using Macromedia Freehand 10 for testing; the Linotype Syntax fonts will show up perfectly in Freehand's font menu, render their "previews" perfectly, and produce a beautiful page, or exported PDF without a problem... most of the time.

Screen shot.
I open a new page in FH10, and add a few lines of type. The Linotype Sans Fonts don't work!


Screen shot.
I save the page, quit and restart FH 10. The font works perfectly.

Why? Good Question!

I'm actively investigating this. I suspect that by the time I've got a definitive answer, there will be a proper application to help us manage the fonts on our systems. No doubt, this has something to do with the fact that the BSD filesystem is very different than what Mac applications (even Carbon apps) have been used to. There are a number of intervening sub-systems between the Mac OS, which is where the application gets its information about the fonts available, and the BSD layer, which actually supplies the data. No doubt some of this has to do with the two part (resource/data) nature of the legacy Mac HFS file system versus the flat data in *nix file systems.

Fortunately, I understand that both Suitcase and Font Reserve are going to release Mac OS X versions of their font management utilities by the end of the year.

During the course of my research, I received a note from Apple Engineering which says that the method I'm using "is not currently supported" but that "it might be something to request as a future enhancement."

If you've found the method useful, you can encapsulate the commands in a shell script. If the script has a .command suffix, the Finder will open it in Terminal and execute it. The following example takes the commands we developed in Part 1 and makes a "double-clickable" script command file out of it. This principle, of course, can be used for many other kinds of tasks, as well.

In TextEdit, (but be sure to save the doc as TEXT, not RTF!) simply type the commands in order, like the following (adjusting for your system and font names, of course. Also, the link command expects that both the source and target directories will be on the same volume):

#! /bin/tcsh

set MyFonts "Lino*Syn*"
set MyFontLib "/Library/Fonts/"
set MyFontSource "~/MyFonts/LSyntax/"

cd $MyFontSource ; find . -name "$MyFonts" -exec ln $MyFontSource\{\}
$MyFontLib\{\} \; ; cd -

Save the file as LinkLinoSyntax.command (as TEXT without the .txt suffix) in your ~/Documents folder.

In Terminal, change the executable bits on the script using

chmod ug+x LinkLinoSyntax.command

so that the long listing shows this:

-rwxr-xr--  1 peterf  staff  246 Aug 10 13:32 LinkLinoSyntax.command

Comment on this articleHave you discovered any work arounds for font management on Mac OS X?
Post your comments

When you double-click on this file in the Finder, the command file will be opened in the Terminal and executed by the command interpreter denoted in the first line. In this case that is /bin/tcsh. (See man tcsh to find out about the default shell in Mac OS X.)

I found that the Finder balked at first, but a re-login seemed to take care of it.

Drop a note if you've tried this! Again, please make sure you've got a backup of your fonts before running this (although the script will not remove anything, it's better safe than sorry)!

An infinite number of other scripts await!

Next time: Using NetInfo to set up local virtual hosts in Apache.

Peter Fraterdeus has been webmastering with Linux since 1993 and became hooked on the Mac after purchasing a 128k model in October 1984.


Return to the Mac DevCenter.