Nuking Font Caches From Orbit

Dr Ken Lunde
8 min readJun 12, 2021

By Dr Ken Lunde, Janitor, Spirits of Christmas Past

“It’s the only way to be sure” — Corporal Dwayne Hicks (Aliens, 1986)

Not a day goes by when I do not use fonts. Whether you are a seasoned font developer or a customer who makes frequent use of a variety of fonts, if you have ever encountered strange font behavior in apps, such as characters not appearing as expected, font menu oddities, printing issues, and so on, then this article is for you.

I apologize in advance that the primary focus of this article is macOS, because that is the OS that I use on a daily basis. For those who use Windows or other OSes, please perform a web search to find relevant articles on this topic.

Come this July 1st, which is less than three weeks from this writing, I will have spent a solid three decades developing fonts. As a professional font developer, I can assure you that this work is not done in a vacuum. Rather, it involves using the fonts—by first installing them into the OS, and then using them in key authoring apps—before handing them off for formal and more rigorous testing prior to release.

This article is about font caching, and in particular, about the need to nuke the font cache from time to time, or more frequently if the circumstances dictate. At least for macOS, the system has its own font cache, and in terms of third-party apps, those developed by Adobe and Microsoft maintain their own font caches.

A font cache stores various metadata about each font that is installed, such as the various names that are associated with a font, along with other attributes. It is possible that some of these attributes may change in a new version of a font, and this is precisely when a font cache starts to work against you.

The following is the font cache record for Source Han Mono Regular (源ノ等幅 Regular) that is created by Adobe InDesign:

%BeginFont
Handler:CoreTextHandler
FontType:CID
FontName:SourceHanMono-Regular
FamilyName:Source Han Mono
StyleName:Regular
FullName:Source Han Mono
MenuName:Source Han Mono
StyleBits:0
FamilyNameNative:源ノ等幅
StyleNameNative:Regular
FullNameNative:源ノ等幅 Regular
WritingScript:Japanese
WritingScriptsMatch:yes
FONDName:源ノ等幅
FONDStyle:0
OutlineFileName:file:///Library/Fonts/SourceHanNotoCJK.ttc#postscript-name=SourceHanMono-Regular
TTCOffset:28032
DataFormat:sfntResource
ResourceID:-32768
isCFF:yes
hasSVG:no
VariableFontType:NonVariableFont
WeightClass:400
WidthClass:5
AngleClass:0
NameArray:1,Mac,65535,源ノ等幅
NameArray:0,Win,1,Source Han Mono
NameArray:1,Win,1,源ノ等幅
%EndFont

If any attribute that is stored in the font cache file is changed in an updated version of a font, the font cache record will no longer correctly reflect the font. This is especially true when a font is under development. For example, it is common practice to tweak a font’s various ‘name’ table strings, and even its PostScript name, during development. This is when it becomes necessary to nuke font caches.

The rest of this article will cover techniques for nuking font caches.

The macOS Font Cache

Under normal circumstances, fonts behave as expected: you type a character and the expected glyph appears in an authoring app, all of the font family’s styles (aka weights) are selectable in the app’s font menu, and the document can be printed or exported to PDF without issues. This is the ideal situation, and thankfully it is also the most common user experience.

However, when using any of the authoring apps that are bundled with macOS, such as Keynote, Numbers, Pages, and TextEdit, if any odd behavior is encountered, particularly after updating to a new version of a font, you may need to nuke the macOS font cache as a prudent first step toward resolving odd font behavior.

If you perform a web search for “macos font cache,” you will find countless articles that provide the same or similar command lines that should be executed via the Terminal app (or equivalent)…

…followed by restarting your machine!

The only twist that I will add in this article is to simply include the command to restart your machine as part of the same command line, to simplify matters a bit:

sudo atsutil databases -remove && atsutil server -shutdown && atsutil server -ping && sudo shutdown -r now

Note that the command line above is actually four separate commands that are separated by && that serves to execute the following command if and only if the previous command succeeded. Also, you may have noticed that two of the commands are prefixed with sudo (superuser do), which requires that the Administrator password be entered, but only once.

Of course, if you are comfortable using the Terminal app, you can add a new alias, such as nukeosfc, to your ~/.zshrc file (or equivalent):

# Nuke the macOS font cache
alias nukeosfc='sudo atsutil databases -remove && atsutil server -shutdown && atsutil server -ping && sudo shutdown -r now'

Nuking the macOS font cache will not help much if you are encountering odd font behavior in Adobe or Microsoft apps, so…

Adobe & Microsoft Font Cache Files

Knowing the exact location of font cache files is key to being able to nuke them. Adobe and Microsoft apps have their own peculiarities, to include maintaining their own font cache files separate from those for macOS proper, and the location may vary from version to version.

I am lumping Adobe and Microsoft apps together here only because the shell function that I present below, nukefc, nukes all known Adobe and Microsoft font cache files, if present.

function nukefc {
KNOWN_FONT_CACHES=(
# Adobe app font cache files
"~/Library/Caches/Adobe/Adobe\ Media\ Encoder*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/After\ Effects*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Character\ Animator*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Fonts/AdobeFnt*.lst"
"~/Library/Caches/Adobe/Prelude*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Premiere\ Pro*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Premiere\ Rush*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/TypeSupport/AdobeFnt*.lst"
"~/Library/Caches/Adobe\ InCopy*/*/*/TypeSupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe\ InDesign*/*/*/TypeSupport/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeCMapFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeComFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeSysFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/*/FontCache/AdobeFnt*.lst"
"~/Library/Application\ Support/Adobe/Adobe\ Photoshop*/CT\ Font\ Cache/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/pdfl/Resource/*/AdobeFnt*"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/typesupport/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/typesupport/cmaps/AdobeFnt*"
"~/Library/Application\ Support/Adobe/Bridge*/CT\ Font\ Cache/AdobeFnt_*.lst"
"~/Library/Preferences/Adobe\ Illustrator*/*/AdobeFnt_*.lst"
"~/Library/Preferences/AIRobin*/*/AdobeFnt_*.lst"
# Microsoft app font cache files
"~/Library/Containers/com.microsoft.*/Data/Library/Application\ Support/Microsoft/FontCache/systemfontmetadata.json"
"~/Library/Containers/com.microsoft.*/Data/Library/Application\ Support/Microsoft/FontPreviewCache/*/*.png"
)
count=0 for known_font_cache in "${KNOWN_FONT_CACHES[@]}"; do
eval "ls ${known_font_cache} &>/dev/null" 2>/dev/null
if [[ $? == 0 ]]; then
echo "Deleting font caches matching: ${known_font_cache}"
eval "rm ${known_font_cache}"
count+=1
fi
done
if [[ $count == 0 ]]; then
echo "No font cache files found!"
else
echo "Nuked one or more font cache files."
fi
}

This shell function can be added to one’s ~/.zshenv file (or equivalent), then executed by simply typing nukefc in the Terminal app (or equivalent).

There’s An App For That

Everyone can deal with an app, because they can be double-clicked from the Finder, or single-clicked when placed in the Application Dock. Although I spend much of my working day in a terminal app, I admit that not everyone is comfortable using the Terminal app on a regular basis.

For those who were not aware, shell functions, such as nukefc, can be easily transformed into a macOS app that, when double-clicked—or single-clicked if placed in the Application dock—will nuke all known Adobe and Microsoft font cache files, if present. Although the Terminal app is used to transform a shell function into an app, once created, the resulting app can be used in the Finder.

The first step is to create the appropriate folder and subfolders, which we will do on your Desktop for easy visibility and simplified testing:

cd Desktop
mkdir -p nukefc.app/Contents/MacOS

Next, copy the following shell script in its entirety:

#!/usr/bin/env zshKNOWN_FONT_CACHES=(
# Adobe app font cache files
"~/Library/Caches/Adobe/Adobe\ Media\ Encoder*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/After\ Effects*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Character\ Animator*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Fonts/AdobeFnt*.lst"
"~/Library/Caches/Adobe/Prelude*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Premiere\ Pro*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/Premiere\ Rush*/*/Typesupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe/TypeSupport/AdobeFnt*.lst"
"~/Library/Caches/Adobe\ InCopy*/*/*/TypeSupport/AdobeFnt_*.lst"
"~/Library/Caches/Adobe\ InDesign*/*/*/TypeSupport/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeCMapFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeComFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/DC/AdobeSysFnt*.lst"
"~/Library/Application\ Support/Adobe/Acrobat/*/FontCache/AdobeFnt*.lst"
"~/Library/Application\ Support/Adobe/Adobe\ Photoshop*/CT\ Font\ Cache/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/pdfl/Resource/*/AdobeFnt*"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/typesupport/AdobeFnt_*.lst"
"~/Library/Application\ Support/Adobe/Animate*/*/Configuration/typesupport/cmaps/AdobeFnt*"
"~/Library/Application\ Support/Adobe/Bridge*/CT\ Font\ Cache/AdobeFnt_*.lst"
"~/Library/Preferences/Adobe\ Illustrator*/*/AdobeFnt_*.lst"
"~/Library/Preferences/AIRobin*/*/AdobeFnt_*.lst"
# Microsoft app font cache files
"~/Library/Containers/com.microsoft.*/Data/Library/Application\ Support/Microsoft/FontCache/systemfontmetadata.json"
"~/Library/Containers/com.microsoft.*/Data/Library/Application\ Support/Microsoft/FontPreviewCache/*/*.png"
)
count=0for known_font_cache in "${KNOWN_FONT_CACHES[@]}"; do
eval "ls ${known_font_cache} &>/dev/null" 2>/dev/null
if [[ $? == 0 ]]; then
eval "rm ${known_font_cache}"
count+=1
fi
done
if [[ $count == 0 ]]; then
osascript -e 'display notification "No font cache files found!" with title "nukefc" sound name "Basso"'
else
osascript -e 'display notification "Nuked one or more font cache files." with title "nukefc" sound name "Glass"'
fi

Finally, use the built-in pbpaste command to paste the pasteboard (aka Clipboard) contents into a new file that will be made executable in the second command:

pbpaste > nukefc.app/Contents/MacOS/nukefc
chmod 755 !$

The nukefc.app should be visible on your Desktop, and if you double-click it, you should see your first on-screen notification. This app can be moved to the system Applications folder to live along side your other apps. You can also drag it to the Application Dock so that it can be conveniently single-clicked.

Depending on the state of affairs of your Adobe and Microsoft font cache files, you should see one of the two notifications shown below:

Of course, one can fairly easily add an icon to this app using the following eight steps:

  1. Open an image using the Preview app
  2. Select Edit > Select All
  3. Select Edit > Copy
  4. Click on the nukefc.app icon
  5. Select File > Get Info in the Finder
  6. Click on the app icon in the upper-left corner of the Info dialog
  7. Paste the icon image
  8. Close the Info dialog

I created the following icon for my private copy of this app, which you are free to use for your own app:

Enjoy and Happy Font Cache Nuking!

About the Author

Dr Ken Lunde worked at Adobe for over twenty-eight years — from 1991-07-01 to 2019-10-18 — specializing in CJKV Type Development, meaning that he architected and developed fonts for East Asian typefaces, along with the standards and specifications on which they are based. He architected and developed the Adobe-branded “Source Han” (Source Han Sans, Source Han Serif, and Source Han Mono) and Google-branded “Noto CJK” (Noto Sans CJK and Noto Serif CJK) open source Pan-CJK typeface families that were released in 2014, 2017, and 2019, is the author of CJKV Information Processing Second Edition (O’Reilly Media, 2009), and published over 300 articles on Adobe’s now-static CJK Type Blog. Ken earned BA (1987), MA (1988), and PhD (1994) degrees in linguistics from The University of Wisconsin-Madison, served as Adobe’s representative to the Unicode Consortium since 2006, was Adobe’s primary representative from 2015 until 2019, serves as Unicode’s IVD (Ideographic Variation Database) Registrar, attends UTC and IRG meetings, participates in the Unicode Editorial Committee, became an individual Unicode Life Member in 2018, received the 2018 Unicode Bulldog Award, was a Unicode Technical Director from 2018 to 2020, became a Vice-Chair of the Emoji Subcommittee in 2019, published UTN #43 (Unihan Database Property “kStrange”) in 2020, and became the Chair of the CJK & Unihan Group in 2021. He and his wife, Hitomi, are proud owners of a His & Hers pair of acceleration-boosted 2018 LR AWD Tesla Model 3 EVs.

--

--

Dr Ken Lunde
Dr Ken Lunde

Written by Dr Ken Lunde

ISO/IEC JTC 1/SC 2/WG 2/IRG Convenor—Almaden Valley—San José—CA—USA—NW Hemisphere—Terra—Sol—Orion-Cygnus Arm—Milky Way—Local Group—Laniakea Supercluster