Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

View a sample of all installed fonts System
I remember at one time being excited to find a "Create Font Sample" script -- it's in the AppleScript menu, under Font Book » Create Font Sample. I remember being disapointed to find out that it only worked on certain fonts. The only way I would be able to make it work would be to add all the fonts to the script.

Today I wished I had a sample of the couple thousand fonts I have on my system, so I decided to look at the "Create Font Sample" script again. Much to my delight, I found that, at some point, Apple fixed this potentially handy script and it now works. I don't know when they fixed it, but I'm glad they did.

[robg adds: I found that, on my machine at least, this script only samples the selected font families in Font Book. The first time I ran it, it printed exactly one sample font. When I looked at Font Book, that font was selected in the Font column. So I clicked on it (to make sure the Font column was active), then pressed Command-A (to select all), then re-ran the script. The script then created a new TextEdit document with a sample of every font on my machine. So if you don't get the results you expect, check the Font column selection in Font Book.]
    •    
  • Currently 2.00 / 5
  You rated: 2 / 5 (4 votes cast)
 
[17,922 views]  

View a sample of all installed fonts | 14 comments | Create New Account
Click here to return to the 'View a sample of all installed fonts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View a sample of all installed fonts
Authored by: jecwobble on Apr 25, '07 08:23:53AM

Is there a way to get the samples grouped into similar font types? Serifs, sans sarifs, scripts, "wingdings", etc.?



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: talltree1008 on Apr 25, '07 08:35:06AM
Check out the free program FontDoc <http://www.macupdate.com/info.php/id/16263>;.

[ Reply to This | # ]
View a sample of all installed fonts
Authored by: brycesutherland on Apr 25, '07 08:48:30AM

I imagine you could click on a collection in the far left pane of FontBook and then select all the fonts that appear in that collection and then print. You'd have to make the collections first though.



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: brycesutherland on Apr 25, '07 08:49:20AM

Argh. Hit the wrong reply button. That was supposed to be a reply to the first comment.



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: craigw on Apr 25, '07 06:23:58PM
I highly recommend the free FontDoc app mentioned above. As a frequent user of fixed width fonts I find it baffling that FontBook does not include this property in a font's info. It should have smart collections, and monospace or variable width should be one of the available criteria! So I have used FontDoc to find all my fixed width fonts, And I now that I see this script, I have modified it to do the same. Simply replace the entire "try" block with something like this:

try
    tell paragraph paraIndex
        set font to psName
        set size to 14
        set characters to tab & "1111hhvviiiillllIIIIjjjj  -  " & psName & return & return
    end tell
on error
    set success to false
end try
if success then
    set paraIndex to paraIndex + 1
end if
try
    tell paragraph paraIndex
        set font to psName
        set size to 14
        set characters to tab & "kk77WWWWxxxxXXXXmmmmPPPP  -  " & size & return & return
    end tell
on error
    set success to false
end try


[ Reply to This | # ]
Bigger is more usefull to me
Authored by: sredlums on Apr 26, '07 03:50:46AM

I tried it, and though it works like advertised, I didn't find itr of much use.
The fonts are so small, that you can't really see them well enough. For example, I have a set of fonts (the're called Unda, by the way) who's letters consist of lines, or dots in diferent variants.
With the normal output, these letters just seem solid, you can't see wich one is dotted, or lined, etc.
So, I played around with the script a bit, and found that if you make the right value something like 50, instead of the default 12, it results in a very nice document, with clear big examples of your fonts. Just set the window of it a little wider, and you can scroll through them easly. Nice!
By the way, I did indeed first 'select all' in FontBook, like Rob suggested.
Thanx for the hint, good one! And yes, it should be incorperated in FontBook...



[ Reply to This | # ]
Oh, I forgot to mention...
Authored by: sredlums on Apr 26, '07 03:53:14AM

...there are three values for the font sizes used in the script, the one I adjusted was the last one of those three.



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: cobbe on Apr 26, '07 04:40:00AM

I'm not able to see the script, let alone run it. If I understand the original post correctly, "Create Font Sample" should appear within the Font Book application as an item under the scripts menu (that is, the menu who's name is the unrolled-scroll icon). Is that correct?

I can't find the script anywhere within Font Book -- Spotlight finds it in /Library/Scripts/Font Book, but I don't even get the Scripts menu. The script doesn't appear in any of the other menus, either. What's going on?

OS X 10.4.9, PowerMac G5, with all security updates.



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: blgrace on Apr 26, '07 06:37:10AM

To get it to work for me I had the enable the Script menu item.
/System/Library/CoreServices/Menu Extras/Script Menu.menu

Or you can enable it with the AppleScript Utility



[ Reply to This | # ]
There's an other way too
Authored by: sredlums on Apr 26, '07 06:08:14PM

I normally just about never use any scripts, and I don't want the ScriptMenu to be active all the time just for the occasional use of this script.
So I just looked for the script in Applications/AppleScript/Example Scripts and double-clicked it.
This will op ScriptEditor, with the chosen script open.
However, instead of editing the script, just click the 'Run' button, and that's that.
Hope this helps.



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: cobbe on Apr 27, '07 03:30:40AM

Ah, that was it. Thanks!



[ Reply to This | # ]
View a sample of all installed fonts
Authored by: b.leopard on Apr 26, '07 08:36:29AM
I've modified the script, because I ordinarily need to compare one phrase with different font families. So I added a dialog first, which asks for the phrase. Furthermore there is a button to quickly jump to FontBook. Enjoy it :-)

(*
Create Font Sample.scpt

This script creates a font sample of the selected fonts in FontBook.app

Copyright © Apple Computer, Inc.

You may incorporate this Apple sample code into your program(s) without
restriction.  This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours.  You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes.  If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.

Modifications made at 2007-04-26
Please contact me in case of further enhancements: b.schreyer@erco.com

*)

repeat
	
	set sampleString to "The quick brown fox jumps over the lazy cat."
	display dialog "Create font sample of all selected fonts in FontBook.app?" & return & return & "Enter sample text:" default answer sampleString buttons {"Cancel", "open FontBook", "OK"} default button 3
	set {buttonReturned, sampleString} to {button returned of the result, text returned of the result}
	if buttonReturned is "Cancel" then
		error number -128 -- quit
	else if buttonReturned is "open FontBook" then -- open FontBook.app and quit
		tell application "Font Book" to activate
		error number -128 -- quit
	else -- sample text
		if the sampleString is not "" then
			set sampleString to sampleString & " – "
			exit repeat
		end if
	end if
	
end repeat

tell application "Font Book"
	
	tell application "System Events"
		set wasTextEditRunning to (name of processes) contains "TextEdit"
	end tell
	
	--	tell application TextEditApp to activate
	
	set selectedFamilies to selected font families
	set selectedTypefaces to selection
	
	set numFamilies to count selectedFamilies
	set numFaces to count selectedTypefaces
	
	tell application "HD_intern:Applications:TextEdit.app"
		if wasTextEditRunning then
			make new document at the end of documents of it
		end if
		tell the front document
			set paragraph 1 to "Font Samples - " & 
				numFamilies & " families   " & 
				numFaces & " typefaces" & return & return & return
			set size to 18
		end tell
	end tell
	
	--	asuuming that items in selection are sorted in font family.
	
	set paraIndex to 3
	
	repeat while selectedTypefaces is not {}
		set thisFace to first item of selectedTypefaces
		set familyName to family name of thisFace
		set selectedTypefaces to the rest of selectedTypefaces
		set postScriptNames to {PostScript name of thisFace}
		
		repeat while selectedTypefaces is not {}
			set anotherFace to first item of selectedTypefaces
			if family name of anotherFace is familyName then
				set the end of postScriptNames to PostScript name of anotherFace
				set selectedTypefaces to the rest of selectedTypefaces
			else
				exit repeat
			end if
		end repeat
		
		tell the front document of application "HD_intern:Applications:TextEdit.app"
			tell paragraph paraIndex
				set font to "LucidaGrande"
				set size to 12
				set characters to familyName & return & return
				set the color of every word to {32867, 32867, 32867} -- 50% gray
			end tell
			set paraIndex to paraIndex + 1
			
			repeat with psName in postScriptNames
				set success to true
				try
					tell paragraph paraIndex
						set font to psName
						set size to 16
						set characters to tab & sampleString & psName & return & return
					end tell
				on error
					set success to false
				end try
				if success then
					set paraIndex to paraIndex + 1
				end if
			end repeat
			set paragraph paraIndex to return & return
			set paraIndex to paraIndex + 1
		end tell
		
	end repeat
	tell application "HD_intern:Applications:TextEdit.app" to activate
end tell


[ Reply to This | # ]
Modified to fix path to TextEdit and ask for font size
Authored by: Krioni on Apr 26, '07 06:23:37PM
Here's b.leopard's script without a hard-coded path to TextEdit. Also, this asks what size to use for the font in your sample, which I believe someone requested above.

(*
Create Font Sample.scpt

Modified by b.leopard on macosxhints.com to include a dialog

This script creates a font sample of the selected fonts in FontBook.app

Copyright © Apple Computer, Inc.

You may incorporate this Apple sample code into your program(s) without
restriction.  This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours.  You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes.  If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.

Modifications made at 2007-04-26
Please contact me in case of further enhancements: b.schreyer@erco.com

*)

set fontSize to 16

repeat
	
	set sampleString to "The quick brown fox jumps over the lazy cat."
	display dialog "Create font sample of all selected fonts in FontBook.app?" & 
		return & return & "Enter sample text:" default answer sampleString 
		buttons {"Cancel", "open FontBook", "OK"} default button 3
	set {buttonReturned, sampleString} to 
		{button returned of the result, text returned of the result}
	if buttonReturned is "Cancel" then
		error number -128 -- quit
	else if buttonReturned is "open FontBook" then -- open FontBook.app and quit
		tell application "Font Book" to activate
		error number -128 -- quit
	else -- sample text
		if the sampleString is not "" then
			set sampleString to sampleString & " – "
			
			set fontSize to text returned of (display dialog "What font size " & 
				"should be used in the sample?" default answer fontSize) as number
			exit repeat
		end if
	end if
	
	
end repeat

tell application "Font Book"
	
	tell application "System Events"
		set wasTextEditRunning to (name of processes) contains "TextEdit"
	end tell
	
	--	tell application TextEditApp to activate
	
	set selectedFamilies to selected font families
	set selectedTypefaces to selection
	
	set numFamilies to count selectedFamilies
	set numFaces to count selectedTypefaces
	
	tell application "TextEdit"
		if wasTextEditRunning then
			make new document at the end of documents of it
		end if
		tell the front document
			set paragraph 1 to "Font Samples - " & 
				numFamilies & " families   " & 
				numFaces & " typefaces" & return & return & return
			set size to 18
		end tell
	end tell
	
	--	asuuming that items in selection are sorted in font family.
	
	set paraIndex to 3
	
	repeat while selectedTypefaces is not {}
		set thisFace to first item of selectedTypefaces
		set familyName to family name of thisFace
		set selectedTypefaces to the rest of selectedTypefaces
		set postScriptNames to {PostScript name of thisFace}
		
		repeat while selectedTypefaces is not {}
			set anotherFace to first item of selectedTypefaces
			if family name of anotherFace is familyName then
				set the end of postScriptNames to PostScript name of anotherFace
				set selectedTypefaces to the rest of selectedTypefaces
			else
				exit repeat
			end if
		end repeat
		
		tell the front document of application "TextEdit"
			tell paragraph paraIndex
				set font to "LucidaGrande"
				set size to 12
				set characters to familyName & return & return
				set the color of every word to 
					{32867, 32867, 32867} -- 50% gray
			end tell
			set paraIndex to paraIndex + 1
			
			repeat with psName in postScriptNames
				set success to true
				try
					tell paragraph paraIndex
						set font to psName
						set size to fontSize
						set characters to tab & sampleString & 
							psName & return & return
					end tell
				on error
					set success to false
				end try
				if success then
					set paraIndex to paraIndex + 1
				end if
			end repeat
			set paragraph paraIndex to return & return
			set paraIndex to paraIndex + 1
		end tell
		
	end repeat
	tell application "TextEdit" to activate
end tell

---
http://www.danshockley.com

[ Reply to This | # ]

View a sample of all installed fonts
Authored by: MariaDaLowTech on Nov 06, '08 01:21:21PM

Please help:
SPECIFICALLY where do I insert this new code to get the additional sample text (fox jumped blah or alphabet)? Thanks a lot!



[ Reply to This | # ]