AS3 Example Font SWF


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

This font SWF was created using the handy tool FontSwffer (http://blog.madebypi.co.uk/2011/02/28/fontswffer-1-1/)


Copy this code and paste it in your HTML
  1. package {
  2.  
  3. import flash.display.Sprite;
  4.  
  5. public class FontSWF extends Sprite {
  6.  
  7. [Embed(source = "arial.ttf",
  8. fontName = "ArialRegular",
  9. fontStyle = "normal",
  10. fontWeight = "normal",
  11. unicodeRange = "U+0020-003C,U+003E-007E,U+00A0,U+00A3,U+00A9,U+00AC,U+00AE,U+00BA,U+2013,U+2018-2019,U+201C-201D,U+20AC",
  12. mimeType = "application/x-font",
  13. advancedAntiAliasing = true
  14. ,embedAsCFF=false)]
  15. public static var ArialRegular_normal_normal:Class;
  16.  
  17. [Embed(source = "arialbd.ttf",
  18. fontName = "ArialBold",
  19. fontStyle = "normal",
  20. fontWeight = "bold",
  21. unicodeRange = "U+0020-003C,U+003E-007E,U+00A0,U+00A3,U+00A9,U+00AC,U+00AE,U+00BA,U+2013,U+2018-2019,U+201C-201D,U+20AC",
  22. mimeType = "application/x-font",
  23. advancedAntiAliasing = true
  24. ,embedAsCFF=false)]
  25. public static var ArialBold_bold_normal:Class;
  26.  
  27. }
  28. }
  29.  
  30. // Handy URLs ...
  31. // http://blog.madebypi.co.uk/2011/02/28/fontswffer-1-1/
  32. // http://nochump.com/blog/archives/20
  33. // http://www.tillschneidereit.de/unicode_range_tool.html
  34. // http://yourpalmark.com/2009/04/05/embedding-fonts-using-external-swf-files/
  35. // http://blog.flexexamples.com/2007/10/25/embedding-fonts-from-a-flash-swf-file-into-a-flex-application/
  36.  
  37. // If you want to point to a relative folder you can do something like this ...
  38. // [Embed(source = "../assets/fonts/arial.ttf", fontName = "ArialRegular", fontWeight = "normal", mimeType = "application/x-font-truetype")]
  39. // private static var ARIAL_REGULAR_FONT:String;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.