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...";
			addChild(subHeader);		
//...
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s