I have a need to get the “metadata” from all of our Fonts. Things like the Family Name, Type, Foundry, Name, and Version.
I tried a hexdump of some font files, but found nothing human-readable. But I know the data exists because Suitcase has it availble.
For example, the font Monaco, available with every Mac. Suitcase tells me the following:
Name: Monaco
Family: Monaco
Foundry: Apple Computer
Type: TrueType
Version: ‘5.0d1e1’
Or Helvetica:
Name: Helvetica
Family: Helvetica
Foundry: Adobe Systems
Type: PostScript pair
Version: '002.000
What I need is a dump of all this data from ALL the fonts. Our fonts, unfortunately are stored all over the place. The System and User libraries, in addition to a Fonts partition (using Suitcase). I’d like a fast way to access this metadata, but right now I have to use Suitcase like this:
tell application "Extensis Suitcase X1"
set font_count to count Font
repeat with i from 1 to font_count
set font_family to family of Font i
set font_type to font type of Font i
set font_foundry to foundry of Font i
set font_name to name of Font i
set font_version to version of Font i
set log_string to font_name & tab & font_family & tab & font_foundry & tab & font_type & tab & "'" & font_version
my logMe(log_string, 0)
end repeat
end tell
logMe is simply a file-writing routine I use.
--
--Log Entry Generation
--
on logMe(log_string, indent_level)
if g_debug is "true" then --allows turning the debugger on and off so logMe's can be left in final version
try
writeEntry(log_string, indent_level, g_log_file_path)
on error
tell application "Finder"
make new file at g_desktop_folder_path with properties {name:g_log_file_name & ".txt"}
end tell
writeEntry(log_string, indent_level, g_log_file_path)
end try
end if
end logMe
on writeEntry(log_string, indent_level, log_file_path)
--streamlined code
repeat indent_level times
write tab to (g_log_file_path as alias) starting at eof
end repeat
write (log_string & return) to (g_log_file_path as alias) starting at eof
end writeEntry
The above method is really slow though. Parsing through 8300+ individual fonts takes 30-45 minutes on a G5–and I can’t do much on the computer while it’s running (Suitcase gets crabby if I try to actually work while this script is doing its thing). I eventually will set this script up to run overnight, but in the meantime…any ideas to speed this up?