Home » AS3, Fonts

Set unicode range in embedded font using flex sdk - as3

12 June 2008 2 Comments

I just noticed that setting the unicode range of an embedded font with the “systemFont” parameter doesn’t seem to work.
The only way to embed a font properly while specifying a character range is to use the “source” parameter and point to the file you want to embed.

To point to your desired font, you can either use an absolute or a relative path:

  • absolute : “c:\windows\fonts\font.tff”
  • relative : “/directory/font.ttf”

Then, simply use the “unicodeRange” parameter as follow :

Embed(source="font_file_name", fontName="font_name", mimeType="application/x-font-truetype", unicodeRange="U+0030-U+0039,U+002E")]

To get a complete list of all the unicode ranges available in flash since Flash MX 2004, just check the “flash-unicode-table.xml” file located in your “flex_sdk_directory\frameworks”.

Some of the commonly used ranges:

  • Uppercase : U+0020,U+0041-U+005A
  • Lowercase : U+0020,U+0061-U+007A
  • Numerals : U+0030-U+0039,U+002E
  • Punctuation : U+0020-U+002F,U+003A-U+0040,U+005B-U+0060,U+007B-U+007E
  • Basic Latin : U+0020-U+002F, U+0030-U+0039, U+003A-U+0040, U+0041-U+005A, U+005B-U+0060, U+0061-U+007A, U+007B-U+007E

And don’t forget to set the “embedFonts” parameter of your TextField at “true“, otherwise your text simply won’t show.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • TwitThis

2 Comments »

  • dimpiax said:

    Thank you for this article.
    Common ranges it’s what I’d been looking for!

  • shammel said:

    it does work… http://gotoandlearn.com/play?id=102

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Security Code: