
You might have read on one of my previous tweets, where I was screaming about using “special” characters in Flash, with “special” I mean arabic, cyrillic, hebrew, chinese simplified and traditional, as well japanese.
I know, I know, there is TLF (Text Layout Framework) that handles the whole text, but I’m talking about embedding the font, did you knew that the complete chinese Unicode range helds something around 20’000 characters? You might think so what? Let me tell you that the complete chinese character range is over 7MB big!!! Do you really want to let your viewers download a 7MB file just for the font? No.
So I’ve created a quick app that will enable you to read out the UTF code from the text you need to use, with it you can specifically embed only the characters you need and take the file size down to a minimum. Now there is only a downside of this method, if the textual content changes a day, you need to again import the new characters.
Apart from that, I haven’t seen any bad things about this implementation.
At the end of this post you will find an useful small tool to get all the needed characters.
As an example below with this line you are embedding a font only containing numerals typing 1234567890 will give you a range from U+0030 to U+0039
Embed(source="font_file_name", fontName="font_name", mimeType="application/x-font-truetype", unicodeRange="U+0030-U+0039,U+002E")]
So let’s assume you would like to write this: “Nemusíte oči vidět, musíte vidění” which means “You don’t need eyes to see, you need vision” and only embed the needed characters, you would embed your font like this
Embed(source="font_file_name", fontName="font_name", mimeType="application/x-font-truetype", unicodeRange="U+004e, U+0065, U+006d, U+0075, U+0073, U+00ed, U+0074, U+0065, U+0020, U+006f, U+010d, U+0069, U+0020, U+0076, U+0069, U+0064, U+011b, U+0074, U+002c, U+0020, U+006d, U+0075, U+0073, U+00ed, U+0074, U+0065, U+0020, U+0076, U+0069, U+0064, U+011b, U+006e, U+00ed")]
If you don’t know how to use this kind of font embedding, have a read here:
http://soledadpenades.com/2008/10/21/embedding-fonts-in-actionscript-3-using-flex-sdk/
Test ride it your self and have fun



Cool, du hast es geschafft
lol
ja noch nicht ganz.. möchte noch ranges abdecken und doppelte einträge entfernen.
great little article and tool, i use it all the time! thanks mate!
This is really great, thanks a lot! It would be perfect if the tool automatically calculates unicode ranges, but thats a good exercise for the reader
Did you already had a look at Vinayaka? http://wiki.six4rty.ch/doku.php?id=vinayaka
More useful (AIR App), outputs a SWF with the fonts and unicode ranges selected.
No, I didn’t see that tool yet. Looks promising, though. Thanks again!