« 2005 MAX Awards | Main | Video Jigsaw Jam »
August 26, 2005
Generating Font Outlines
As most folks know fonts and text display is very much an outline/path driven routine and as such one might want to use a particular font and instead of showing it as text, they might simply want the vector outline for a particular string. Well, another one of Director's hidden gems is the ability to do just that using font cast members and their undocumented (and therefore untested!) generateOutlines() method.
If you have a font cast member present in your movie you generate a vertex list defining the outlines of a specified string using that font. This capability is provided via the undocumented generateOutlines cast member method. With this command you provide the desired string and the vertex list is returned, that list can then be applied as you wish, but an obvious candidate is to apply that vertex list to a vector shape cast member. Here's how you do it:
1. In a Director movie, insert a font from your system. This can be done using Insert > Media Element > Font... Please note that when doing this choose the font you want to use in order to create the vector outline of your string.
2. Once you have your font cast member, just call generateOutlines() as a method of that member and provide the string whose outline is to be generated and returned:
tVertexList = member("MyFont*").generateOutlines("Some String")
Note: you must provide a valid string with at least one non-space character or else a script error will occur.
The generateOutlines() method returns a vertex list that can be used for whatever purpose you desire, one simple method of using this list is to apply it as the vertex list for a vector shape cast member. For example:
member("MyVectorShape").vertexList = member("MyFont*").generateOutlines("Some String")
Have fun!
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 August 26, 2005 02:51 PM