Set unicode range in embedded font using flex sdk – as3

0 Flares Twitter 0 Facebook 0 Google+ 0 Email -- Filament.io 0 Flares ×

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 :
[sourcecode language=’cpp’]
Embed(source=”font_file_name”, fontName=”font_name”, mimeType=”application/x-font-truetype”, unicodeRange=”U+0030-U+0039,U+002E”)]
[/sourcecode]
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.

0 Flares Twitter 0 Facebook 0 Google+ 0 Email -- Filament.io 0 Flares ×

2 Comments

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

Leave a Comment

*