Posted By

MartinMller on 08/10/12


Tagged

font embedding


Versions (?)

Font Embedding


 / Published in: ActionScript 3
 

Font embedding

Font embedding and prevention of anti aliasing which is good for bitmap fonts:

  1. //Embedding the font:
  2. [Embed(source="FONT.ttf", fontName = "myFont", mimeType = "application/x-font-truetype", advancedAntiAliasing="true", embedAsCFF="false")]
  3. private var myEmbeddedFont:Class;
  4.  
  5. //Creating the textformat:
  6. var defaultTextFormat : TextFormat = new TextFormat('myFont');
  7.  
  8. //Applying the font to a textfield:
  9. myTextField.defaultTextFormat = Config.defaultTextFormat;
  10. myTextField.embedFonts = true;
  11. //These two next lines prevent anti aliasing - good for bitmap fonts:
  12. myTextField.antiAliasType = AntiAliasType.ADVANCED;
  13. myTextField.sharpness = 400;

Report this snippet  

You need to login to post a comment.