macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Font Management in Mac OS X
Pages: 1, 2

Approaches to font management

One of the main advantages of Adobe Type Manager, et al, is the freedom to leave fonts organized as you like, each family in its own folder. ATM allows you to create a reference to the fonts and tells the System where to find the resource when it's called for.



We can do a similar thing using BSD-level file links, which, unlike the Finder alias, convince the system that the font actually is residing in the appropriate Font folder.

Linotype Syntax is Hans Eduard Meier's redrawing of his Syntax family for modern ultra-high resolution typesetting. Meier and Linotype have extended Syntax with a serifed complement, and an informal "letter" face.

For instance, I've been using the beautiful Linotype Syntax family, a large series of Postscript fonts, redesigned and engineered to take full advantage of ultra high resolution output devices. The family has thirty fonts and includes small caps, old-style numerals, and four weights. I'd prefer to leave the fonts in a single folder and be able to install or remove them at will.

Comment on this articleThe joy of font management in Mac OS X! What tricks have you discovered to help keep your sanity while we wait for formal tools to arrive?
Post your comments

Apple/MS font sites

Apple - Fonts/Tools

Microsoft Typography

TrueType characters are described with a "second-order" b-spline curve, while PostScript used a more complex third-order Bezier spline curve. Bezier splines are generally easier to use interactively (like drawing in Adobe Illustrator or Macromedia Freehand). TrueType b-splines require more care in the placement of points, but are considered capable of matching a given curve more efficiently.

AAT - Apple Advanced Typography

Hermann Zapf's Zapfino font family takes advantage of contextual substitution, using special multi-character glyphs such as "gg," "st," and so forth, which are dynamically inserted into the text stream as you type in AAT-aware applications, such as OSX TextEdit. (Turn on Ligatures in the Font -> Ligature menu.)

Apple Type Services for Unicode Imaging (ATSUI)

Apple Advanced Typography (Swash Font Feature Selectors)

Antialiasing

It's important to have the option to turn "aa" off, particularly with LCD screens, where letters seem to be substantially less legible due to the fuzziness. Some in the professional font design community tend toward the opinion that Apple's implementation leaves much to be desired. In particular, there are tables in TrueType fonts which indicate the point sizes at which hinting and anti-aliasing should be applied, or not. The Quartz rendering engine does not seem to respect these data, which has been indicated by the font's designers. Adobe's latest Acrobat Reader, on the other hand uses the CoolType rendering system to optimize the appearance of "aa" type on LCD screens.

We'll use some file globbing and linking to install links from the original file into the Classic System Fonts folder (making them available system-wide!), and a similar method to remove them. (Note that Apple's .dfonts will not not work with Classic apps, since the Classic OS doesn't know that these are fonts! Come back next time for the scoop on .dfonts, .otf, .ttf, and the rest!)

To link the contents of a folder, we do something like this in Terminal:

# note the single quotes in this line to preserve
# the space (adjust for your Classic startup volume)

setenv ClassicStartUpVol '/Volumes/rasalas/'

# the rest are double quoted to allow for shell
# substitution

setenv MyFonts "Lino*Syn*"
setenv MyFontLib "$ClassicStartUpVol/System Folder/Fonts/"
setenv MyFontSource "$ClassicStartUpVol/Fonts/LSyntax/"

The setenv command adds an environment variable to the user environment. Here, we've defined user variables which are used in the statement below. This is standard programming technique -- isolate the variable data, generalize the command. If you type env the system will list the current environment vars.

Note: The fonts must be on the same volume as the Classic Startup System Folder. I've found that "symbolic links" ("symlinks") don't seem to do the job as well as "hard" file links, which cannot be used across volumes. In addition, some OS X apps can't seem to find the fonts in the Classic font folder. In this case, install them in /Library/Fonts/ or ~/Library/Fonts/ instead.

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

This line has three parts, each command separated by a semi-colon. First, we cd (change directory) to the font source directory. Then the working parts:

The first argument to the find command (look it up with man find) is the directory to search. Since we've changed to the source directory already, I use the single dot, which indicates the current working directory.

The next argument is a series of conditions which are evaluated for each file under the search directory (note that by default, find will search through the entiredirectory tree under the search directory)

In this example, I'm asking find to select all the files which match the pattern which I've stored in the variable $MyFonts (the $ is required to access the value). Here, that value is Lino*Syn*. If you recall from my previous article, Unix for the Rest of Us, the * in a shell expression is a "globbing" operator that matches any characters in the name. Thus, our pattern will match any file name in the search directory which begins with the characters "Lino" and includes the characters "Syn" somewhere before the end of the name. Note that the search is case-sensitive by default. Note also that spaces are included in the "glob."

In this case, we will match filenames similar to these:

LinotSynHea
LinotSynMedIta.AFM
LinotSynOsFBla
LinotSynOsFBla.AFM
LinotSynOsFBlaIt
LinotypeSyntax Medium
LinotypeSyntax OsF Black

The third part of the find statement is the -exec clause. The string following -exec, up to the next semi-colon, is a command wherein the current filename is inserted at the {} markers. Since the brackets are also shell delimiters, we have to "escape" that context by preceding each bracket with a backslash.

We also precede the semi-colon with a backslash, since it also has meaning to the shell, which is to separate multiple commands on the same line. In this case, I've added just such a semi-colon, and finally the last command, cd -, which returns us to our prior working directory.

So, as the find command selects each filename in order, the exec statement would be built, and then executed by the shell. The commands might look like these, if we were to echo the string before it's executed:

ln /Volumes/rasalas/Fonts/LSyntax/./LinotSynSCReg /Volumes/rasalas/System Folder//Fonts/./LinotSynSCReg
ln /Volumes/rasalas/Fonts/LSyntax/./LinotSynSCReg.AFM /Volumes/rasalas/System Folder//Fonts/./LinotSynSCReg.AFM
ln /Volumes/rasalas/Fonts/LSyntax/./LinotypeSyntax Medium /Volumes/rasalas/System Folder//Fonts/./LinotypeSyntax Medium

The ln command creates a link or reference between the source file (the first argument) and the link named in the second argument.

This is similar in effect, but substantially different in operation, to a Mac Finder alias. (A Finder alias is dynamically updated if you move the source file, for example.)

To the Finder, the link appears to actually bethe file itself. With each "link" to a file, the BSD file system creates a pointer to the actual data on the storage device.

It may be useful to re-login before using the newly installed fonts. However, most of the applications I tried seemed to recognize the fonts after restarting the app. I've successfully used this method in Macromedia Freehand 10, both printing and exporting valid PDF with the fonts embedded. In Classic, Photoshop 6.01 accepts the new fonts as well.

To reverse the installation, we'll reuse the environment variables and simply say:

cd $MyFontLib ; rm "$MyFonts" ; cd -

First, we cd to the font library (not the font source, where the original fonts are!), then use the rm command to remove the links:

Note that the rm command, by default, does not remove files recursively in directories other than the current working directory. However, the $MyFonts environment variable is expanded by the shell, and all of the links are removed from the current directory.

This gives us a primitive but effective method of font management while we're waiting for developers to move ahead with OSX native tools. I hope you've been able to follow the procedure. Obviously there are many ways that we can extend this process to make it more flexible. For instance, you can try creating font sets in folders, and have the process add all the fonts within the set. (The problem comes when you want to remove each of them!)

In my next article, we'll make some "containers," which encapsulate this behavior into double-clickable scripts.

I look forward to your comments and suggestions regarding this technique. I should also offer a disclaimer: YMMV (your mileage may vary) and don't try this with fonts that you don't have backed up somewhere else ;-) There are some inconsistent behaviors that pop up using this method. I'm not really sure why, but occassionally, I would find that Freehand 10 would "forget" where the Type 1 outlines were, and show only chunky, aliased bitmaps. Generally, this was remedied by restarting the application. However, I can't understand why it would work sometimes, and not others. I'd love to hear from anyone with an explanation!

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.