Tip / trick: making Adobe fonts available to fontconfig
From:
Trevor Bača
Subject:
Tip / trick: making Adobe fonts available to fontconfig
Date:
Mon, 4 Feb 2008 15:26:05 -0600
Hi,
It took me some time this weekend to figure out how to use Adobe Caslon Pro type in the score I'm just now finishing up. The secret turned out to be to hunt down the font files in question on my filesystem and then to put a copy of those files into the magic ~/.fonts directory. Full notes follow.
TOPIC: making application-specific fonts (like Adobe Caslon Pro) available to fontconfig (and thereby LilyPond).
AUDIENCE: cross-platform users of LilyPond (Linux, OS X, Windows), though tested only under OS X.
TAGS: fonts, fontconfig, ~/.fonts, pango, markup.
DESCRIPTION. NR 1.8.2.4 "Font selection" reads, in part, "Any font can be used, as long as it is available to
Pango/FontConfig." This comes out to mean that LilyPond depends on both the pango (www.pango.org) and fontconfig (http://fontconfig.org) utilities for font-handling. (The benefits of doing this are internationalization, in the first case, and OS-wide font organization and centralization, in the second.) But what happens when a font you want is specifically *not* available to pango / fontconfig? And how can you tell?
Running lilypond -dshow-available-fonts gives a complete list of those fonts that fontconfig knows about, usually running several hundred lines:
<snip> family Geneva Geneva:style=Regular,Standard,Testo lig tekst,Normaalirmal,Común,Almindelig,Vann
family STHeiti STHeiti:style=Lightfamily New Peninim MT New Peninim MT:style=Inclinedfamily Copperplate Copperplate:style=Light family Cracked Cracked:style=Regular <snip>
(The command writes to standard error rather than standard out; to capture output to a file, try lilypond -dshow-available-fonts 2>fonts.tmp).
In my case Adobe Caslon Pro appeared nowhere in this output and so I knew that fontconfig simply didn't know about the font I wanted to use. I knew the font was installed on my system because (1) it showed up in InDesign and (2) spotlight revealed the fontfiles ACaslonPro-Bold.otf, ACaslonPro-BoldItalic.otf, ACaslonPro-Italic.otf, ACaslonPro-Regular.otf, etc, in the /Library/Application Support/Adobe/Fonts/ directory.
My hunch was that fontconfig simply wasn't searching /Library/Application Support/Adobe/Fonts/ and so was unable to make the font available to LilyPond. This turned out to the be correct.
SOLUTION. The solution is to teach fontconfig the whereabouts of the fontfiles in question. In this case all that was necessary was the following copy:
(Make sure that the directory ~/.fonts exists first.)
As a sidenote, it seems like a more permanent solution would be to edit the configfile /etc/fonts/fonts.conf to contain /Library/Application Support/Adobe/Fonts/. On my system, that means changing ...
... so that now, presumably, fontconfig will know about all of the Adobe application fonts.
I did in fact do this, but I haven't had time to figure out how to tell fontconfig to rebuild the font cache (or whatever the equivalent action is). If anybody knows (or can find) the correct way to kick off a font cache rebuild, I'll test and post OS X results back to this thread.