/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { //-------------------------------------- // IMPORT //-------------------------------------- import flash.display.*; import flash.text.*; public class embedTest extends Sprite { [Embed( source='/fonts/DINOT-Regular.otf', fontName="DINOT-Regular", mimeType="application/x-font-truetype" )] private var pFont:Class; /** * @Constructor */ public function untitled():void{ // DEFINITIONS //-------------------------------------- Font.registerFont(pFont); } private function createLink() : void { tf = new TextField(); tf.text = 'foo'; formatText(tf, T_COLOR, 12, true); tf.embedFonts = true; this.addChild(tf); } private function formatText(_tf:TextField, _color:Number, _size:Number, _bold:Boolean = false) : void { var tFormat:TextFormat = new TextFormat(); tFormat.font = 'DINOT-Regular'; tFormat.color = _color; tFormat.size = _size; tFormat.bold = _bold; _tf.setTextFormat(tFormat); } } // END embedTest Class } // END package