Calling method "availableFonts"


Can anyone point me to the proper way of calling this method of NSFontManager:

  • (NSArray *)availableFonts;

to get the list of active fonts?

As a list, string or whatever else is digestable by AppleScript.

I was successfull to call various methods before (well, mostly from samples), but am lost when it comes to this one.

Any help will be appreciated.

And also wanted to thank Dennis for helping me to bring file attributes into FileMaker long time ago - it helped me a lot and I didn’t get a chance to acknowledge it back then.


Hi Leo,

is there no AppleScript solution to get a list of all fonts? Hmmm anyway - if you want to use the availableFonts method then:

  1. Add a new File in your xCode project of type ‘Cocoa/Objective-C class’ - name it: ‘MyFontlist’

  2. you now see two additional files called MyFontlist.h and MyFontlist.m - edit them that the look like so:


#import <Cocoa/Cocoa.h>

@interface MyFontlist : NSObject {}

+(NSArray *)MyFontlist;



#import "MyFontlist.h"

@implementation MyFontlist
+(NSArray *)MyFontlist {
	NSFontManager *fontManager = [NSFontManager sharedFontManager];
	NSArray *theList = [fontManager availableFonts];
	[fontManager release];
	[theList retain];
	[theList release];
	return theList;


then you can call this method from your script:

set thelist to (call method "MyFontlist" of class "MyFontlist")

Of course you are free to name method and clas to whatever you like ‘MyFontlist’ is just an example.


I think this is the syntax:

set sFM to (call method "sharedFontManager" of class "NSFontManager")
call method "availableFonts" of sFM

Fantastic! Thanks a lot, Dominic!

And BTW, that’s true, there’s no way to get the list of active font with AppleScript, as far as I know at least.


Not vanilla, but you can use these (OS X), appart from the mentioned “call method”:
Hmmm… And this one:

tell application "Smile" to (get its «class FLST»)

(And I’m sure there are more ones)