Embedding fonts in ActionScript 3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Create a new instance of the Font1 symbol from the document's library.
  2. var myFont:Font = new Font1();
  3.  
  4. /* Create a new TextFormat object, and set the font property to the myFont
  5.   object's fontName property. */
  6. var myFormat:TextFormat = new TextFormat();
  7. myFormat.font = myFont.fontName;
  8. myFormat.size = 24;
  9.  
  10. /* Create a new TextField object, assign the text format using the
  11.   defaultTextFormat property, and set the embedFonts property to true. */
  12. var myTextField:TextField = new TextField();
  13. myTextField.autoSize = TextFieldAutoSize.LEFT;
  14. myTextField.defaultTextFormat = myFormat;
  15. myTextField.embedFonts = true;
  16. myTextField.text = "The quick brown fox jumped over the lazy dog.";
  17. addChild(myTextField);

URL: http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.