Embedding fonts on Mac with AS3

Recently noticed that some standard code that works fine for embedding Open Type and True Type fonts in an AS3 application in the Flash IDE, doesn’t always work for some Postscript fonts.

It turns out that only Type 1 Postscript fonts can be embedded in Flash. If the Postscript font is Type 0, Type 5, or Type 9 it won’t work. That’s what this Adobe quickstart page seems to imply.

Here’s an example that worked fine for True Type, Open Type but not for some Postscript fonts:

			font1 = new ArialFont1(); //12pt 
			myFormat2 = new TextFormat();
			myFormat2.font = font1.fontName;
			myFormat2.size = 13; 
			myFormat2.leading = 2;
			myFormat2.color = 0x000000; 
			subHeader = new TextField();	
			subHeader.defaultTextFormat = myFormat2; 
			subHeader.width = 300;
			subHeader.height = 150; 			
			subHeader.embedFonts = true;
			subHeader.wordWrap = true;
			subHeader.multiline = true; 	
			subHeader.x = 175; //110
			subHeader.y = 96;
			subHeader.htmlText = "place holder text...";

Making fonts in AS3 is fun

The instructions that come with the FIVe3D font making utility are pretty clear overall but on OS X 10.4 it can be confusing to find which WindowSWF folder to use. Is it /Applications/Adobe Flash CS4/en/Configuration/WindowSWF/ ? Or is it /Applications/Adobe Flash CS4/Common/First Run/WindowSWF/ ?

Actually, the place to put “Make a new typography file.swf” is here: /Users/youruserhandle/Library/Application Support/Adobe/Flash CS4/en/Configuration/WindowSWF/.

I used a font called Roadkill. When the font was created, the Flash CS4 Output window said: ‘”Roadkill.as” is in the current folder.’

Since my hard drive is partitioned, it wasn’t immediately clear what was meant by “current folder” in this case. The font.fla file I used to create Roadkill.as via the font-making utility was on the 2nd partition, i.e. not on the main partition.

It turns out “current folder” meant the top most directory on the main partition on my OS X machine, right next to Users, Developer, Library, Applications, System.