Listing fonts

Is there a simple way (and universal – i.e., with Apple apps only) to get a list of fonts installed on a machine?

Hi Adam,

two suggestions:


tell application "Font Book" to get name of typefaces

or the shell equivalent


do shell script "system_profiler SPFontsDataType | grep 'Full Name' | cut -d ':' -f 2 | cut -c 2-50"

Thank you Stefan – getting paragraphs of the shell version produces a nice list too. :wink:

And this does what I want:

tell application "Font Book" to set myFonts to my removeDupNames(name of typefaces)

on removeDupNames(L)
	set tList to {}
	repeat with I in L
		set I to word 1 of I
		if tList does not contain I then set end of tList to (contents of I)
	end repeat
	return tList
end removeDupNames

Better yet:

tell application "Font Book" to set myFonts to my removeDupNames(name of typefaces)
set newLine to ASCII character 10
tell (a reference to my text item delimiters)
	set {old_atid, contents} to {contents, newLine}
	set {myFonts, contents} to {myFonts as Unicode text, old_atid}
end tell
set myFonts to (do shell script "echo " & quoted form of myFonts & " | sort")'s paragraphs

on removeDupNames(L)
	set tList to {}
	repeat with I in L
		set I to word 1 of I
		if tList does not contain I then set end of tList to (contents of I)
	end repeat
	return tList
end removeDupNames

And this is where I was going: the user gets to enter a font name and this script checks to see if it’s there (without attributes like bold or italic):

– Thanks for the kick start to get over my senior moment :lol:

tell application "Font Book" to set myFonts to my removeDupNames(name of typefaces)
set newLine to ASCII character 10
tell (a reference to my text item delimiters)
	set {old_atid, contents} to {contents, newLine}
	set {myFonts, contents} to {myFonts as Unicode text, old_atid}
end tell
set myFonts to (do shell script "echo " & quoted form of myFonts & " | sort")'s paragraphs

set aFont to "Hlvetica"
aFont is in myFonts  --> false

on removeDupNames(L)
	set tList to {}
	repeat with I in L
		set I to word 1 of I
		if tList does not contain I then set end of tList to (contents of I)
	end repeat
	return tList
end removeDupNames

You’re welcome :slight_smile: