Embedding Multiple File True Type Fonts in Flex

Many True Type Fonts (TTF) are made up of multiple .TTF files. One file will be for the normal font, while another file is for the Bold version of the Font. For example, the Verdana font that comes with Windows XP consists of four separate files.

The following code shows how to include multiple TTF files into a Flex CSS file.

  1. @font-face
  2. {
  3. src:url("font/verdana.TTF");
  4. font-family: EmbeddedVerdana;
  5. font-weight: normal;
  6. font-style: normal;
  7. }
  8.  
  9. @font-face
  10. {
  11. src:url("font/verdanab.TTF");
  12. font-family: EmbeddedVerdana;
  13. font-weight: bold;
  14. font-style: normal;
  15. }
  16.  
  17. @font-face
  18. {
  19. src:url("font/verdanai.TTF");
  20. font-family: EmbeddedVerdana;
  21. font-weight: normal;
  22. font-style: italic;
  23. }
  24.  
  25. @font-face
  26. {
  27. src:url("font/verdanaz.TTF");
  28. font-family: EmbeddedVerdana;
  29. font-weight: bold;
  30. font-style: italic;
  31. }
  32.  
  33. Application
  34. {
  35. font-family: EmbeddedVerdana;
  36. }

2 Responses to “Embedding Multiple File True Type Fonts in Flex”

  1. DJ Says:

    Tanks for this post. But how do we use these font to render HTML text.

  2. David Beale Says:

    @DJ
    You can use these fonts in <font> tags within HTML text provided to a Text Components htmlText property.

    See http://livedocs.adobe.com/flex/3/langref/flash/text/TextField.html#htmlText


Leave a Reply

Copyright © 2005, David Beale

  • Valid XHTML 1.0!
  • Valid CSS
  • Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0