Return to Snippet

Revision: 58498
at July 18, 2012 18:00 by ronniekleinfeldgmailcom


Initial Code
package DatePercent.Samples
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class EmbededFonts extends Sprite
	{
		// embed the font.ttf file from the same folder as this swf
		[Embed(source="assets/FontSample.ttf",
		    fontName = "myFont", 
		    mimeType = "application/x-font", 
		    fontWeight="normal", 
		    fontStyle="normal", 
		    advancedAntiAliasing="true", 
		    embedAsCFF="false")]
		private var fontFontSample:Class;
		
		
		public function EmbededFonts()
		{
			super();
			
			var textFormat:TextFormat = new TextFormat();
			textFormat.font = "myFont";
			textFormat.bold = true;
			textFormat.letterSpacing = 10;
			
			var textField:TextField = new TextField();
			textField.width = 300;
			textField.embedFonts = true
			textField.text = "Use embeded font";
			textField.textColor = 0x0000ff;
			textField.setTextFormat(textFormat);
			
			this.addChild(textField);
		}
	}
}

Initial URL

                                

Initial Description
Embeding fonts in as3

Initial Title
Embeding fonts in as3

Initial Tags

                                

Initial Language
ActionScript 3