Archive

Posts Tagged ‘runtime font’

Runtime Fonts with Unicode Range

October 29th, 2009

For a couple of months ago I publish a post about fonts embed with unicode range. There are ways on how to extract the fonts from Flash files with some de-compiling but for those who found the article interesting but never figured out the unicodeRange bit, well there is a solution.

1.) First look on how to setup and use the FontManager
2.) Download UnicodeHexCreator I created to create the unicodeRange.

The AIR Unicode app is used to create the correct unicode range to optimize the amount of bytes that is needed to be loaded. To get the range it’s really simple.

1.) Copy/Paste your entire XML file to the input field (top field)
2.) Select font to use and set class name.
3.) Press convert
4.) Copy/Paste the unicodeRange to the Flex Project that creates the font file.

Download UnicodeHexCreator.

Flash, Flex , , , ,

Runtime Dynamic fonts Flash CS3

January 28th, 2008

All the examples showing runtime dynamic fonts for flash cs3 includes that you export swf file with a class that contains embedded font [Embed ??my font??].

This doesn’t really works for me because I need specified characters for a lot of different countrys. Usually when developing a flash application I have to handle between 15-50 countrys.

embed01

So I made my own little solution, made one of these for flash 6 for a couple of years ago and the trick still works. It basiclly works by loading shared runtime librarys and then embedded fonts will be shared cross the application when using a lot of swf files.

Making it a static class it’s easy to use.

CSS.loadStyleName = "default";CSS.loadStylePath = "css/";CSS.addEventListener(IOErrorEvent.IO_ERROR, this.onError);CSS.addEventListener(Event.COMPLETE, this.onComplete);CSS.initialize( this );

And then to use it on textfields.

txtField.styleSheet = CSS.styleSheet;txtField.embedFonts = true;txtField.htmlText = "<span class='subTest'>Embed Arial</span>";txtField.rotation = 5;
 
txtField2.styleSheet = CSS.styleSheet;txtField2.embedFonts = true;txtField2.htmlText = "<span class='subTest'>Try embed Arial Black</span>";txtField2.rotation = -5;

To make this work.

1.1) Create your shared library file (example: default_lib.fla)

1.2) Create MovieClip on stage and export it for runtime.

1.3) In the MovieClip create a textfield for each font you need, embedd all the characters needed.
embed02

2.1) Create your shared library holder file (example: default.fla)

2.2) On the stage add the runtime MovieClip and give it instance name mcFont

3.1) Create your css file (example: default.css)

3.2) Add the styles that your need
embed03

4.1) In the Application file add the following load code (look at example in top)

You can download example files here: runtimefonts_as3

Flash , , ,