Thursday 6 March 2008

Swf fonts, flex and Unicode characters

If you have developed any scientific or mathematical applications you will know the headaches surrounding superscripts, subscripts and weird greek numerals etc in Flash or Flex. We have discovered a solution to some of these issues (well actually my good developer friend Thierry cracked this one but I thought it is worthy of a posting!)

Basically the situation is that you have found a good Unicode font that contains all the characters that you need to embed into a swf font for exporting into Flex. The problem you will encounter is that not all the characters end up being embeded even though they are included in the actual font. The font we have been using is Arial Unicode MS. I checked on windows using the character map to check whether the font contained the characters needed (which were all numerals sup and sub), it did but they weren't importing. The solution to this problem is fairly simple. What you need to do is add the characters you need to the Autofill box as shown below:

Here are the steps:
1. Go into character map in windows (programs/accessories/system tools/character map) choose the unicode font you want, in this case 'Arial Unicode MS'

2. Click on group by Unicode Subrange then choose super/subscript from the list that appears in the window, once you have selected that you will see the available characters in the main window.

3. Click on each character you need and click 'select' below this will add the selected character to the list.

4. Once you have selected the characters you want copy them all to the clipboard and paste them into a dynamic text box in flash.

5. Select the text box and click on 'embed' in the font properties window, then click on 'Auto Fill', this will add all the characters to the exported movie!

Hope that helps.

No comments: