Hi All!

Probably the most popular approach to load fonts runtime is to generate SWF
files either in Flash or in Flex where font is registered via
Font.registerFont(fontClass).

In Flash you normally add it to the library.

In Flex you embed it via [Embed] metatag.

And we have used this approach for a while as a guideline for content
developers.

In our Flex application this works perfect.

But now we need to show the same content in the AIR application.

And since all SWF fonts are in the local-with-file sandbox, their
Font.registerFont() calls are just ignored.

In other words, when I create text fields upon the SWF font loading and use
that loaded font, it just does not work.



*private* *function* onEmbeddedFontComplete() : *void* {

*trace*(Font.enumerateFonts().length); *// Output 0;
*

*var* textField : UITextField = *new* UITextField();

textField.htmlText = *"<font face='SegoeScript'>Segoe Script</font>"*;

textField.rotation = 30;

box.addChild(textField);

}

...

<mx:SWFLoader id="embeddedFont" complete="onEmbeddedFontComplete()" />
I suppose this should be quite common problem when you are creating some
text editing software that works with runtime loaded fonts which are not
deployed along with the application, but created by users, and eventually
you need to migrate to AIR.

Any ideas how to avoid the problem without modification to the content (we
already have a lot of font files in use and we can not enforce users to
redevelop all)?

Sergey.

Reply via email to