« Getting a list of installed fonts | Main | Updated Shockwave Player installer released today »

February 08, 2005

Getting a list of installed recordable fonts

Sorry, I missed last Friday's appointment to post up another undocumented gem, my apologies for the delay, read on...

Last week I dropped a hint about the undocumented fontList() method of Font cast members in Macromedia Director. Well, this week I want to extend that a bit further by discussing another undocumented Font member method, outlineFontList(). When called this method behaves similar to the fontList() method but instead of returning a list of all installed font names it returns a linear list containing the names of all recordable or insertable fonts.

Macromedia Director has long supported the ability to import Fonts as cast members in order to render text on a user's machine where that user doesn't have the needed font. In order to insert a font Macromedia Director's Font Xtras "record" or store the font's outlines within a font cast member for later use. Only outline fonts can be recorded and so often a given machine will have many fonts that can't be inserted/recorded into Macromedia Director. Normally the list of fonts that can be inserted is found by going to Insert > Media Element > Font..., but now using this method you can get the list of names through code as well.

Let's look at some code examples...

1. Create a font cast member
You can do this ahead of time by inserting a font using Insert>Media Element>Font..., or you can do it at run-time using code:

-- in Lingo
tFontMem = new(#font)
-- or
tFontMem = _movie.newMember(#font)

// in JavaScript syntax
var tFontMem = _movie.newMember( symbol("font") );


2. Call the outlineFontList() method off a font member reference
Once you have a reference to a valid font cast member you simply call the outlineFontList() method off that reference:

-- in Lingo
tFontList = tFontMem.outlineFontList()

// in JavaScript syntax
var tFontList = tFontMem.outlineFontList();

When called this method builds a Lingo linear list of strings, where each string in that list is the name of a system-installed font that is recordable or insertable as a cast member inside Macromedia Director.


Enjoy.


Disclaimer: I make no guarantees regarding validity or usefullness of the information contained in this post. This feature was left as undocumented, and therefore unsupported on purpose, it either wasn't fully developed and/or it wasn't fully tested. I suggest that you utilize this technique in experimental movies due to the potential risks involved. There is no guarantee that this undocumented feature will survive from release to release. Use this technique at your own risk!

Posted by thiggins at February 8, 2005 11:41 AM