The applicationDomain shouldn't matter because all of the related classes should be wrapping a DefineFont object. LoadBytes() lets you choose an applicationDomain topology so you can always load directly into the main one if you want.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Sergey Kovalyov Sent: Wednesday, November 11, 2009 8:49 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Runtime fonts embedding in AIR But it seems that in this case loaded SWF resides in the different applcation domain and thus its Font.registerFont() call does nothing for the parent application. On Wed, Nov 11, 2009 at 1:25 AM, Alex Harui <aha...@adobe.com<mailto:aha...@adobe.com>> wrote: I think most folks load the SWF as a byteArray using URLLoader then use Loader.loadBytes() to load the SWF. Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com>] On Behalf Of Sergey Kovalyov Sent: Tuesday, November 10, 2009 5:54 AM To: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com> Subject: [flexcoders] Runtime fonts embedding in AIR 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.