Christopher Grigg
Christopher Grigg

Reputation: 2308

Embedded fonts in external SWF conflict

I have a problem where an external SWF (from an external party) I am loading into my app loses its font rendering (with an external font) when I load it into my app. On it's own the Fonts appear to be rendered nicely and when I test loading this external SWF into a simple test project.

So it appears to me there is a conflict maybe with Fonts I'm embedding into my app. However, I have deleted all functionality related to this and it has not fixed my problem. Any ideas as to why there is a conflict?

EDIT ** Interestingly this problem occurs only when the ApplicationDomain is set to null. When the child SWF shares the parent SWFs domain the fonts render correctly.

Thanks

Chris

Upvotes: 1

Views: 547

Answers (2)

Christopher Grigg
Christopher Grigg

Reputation: 2308

The problem was, as3 doesn't like to register fonts on different domains. So I passed an instance of the parent "ApplicationDomain" to the child swf and the child swf registered fonts to this instance.

Upvotes: 0

fsbmain
fsbmain

Reputation: 5267

You were right in your suggestion about fonts conflicting. There are several rules with embed fonts that will help you to solve this issue:

  1. Try not to use static text fields. All symbols from static text field will be embedded by Flash IDE into your swf, so if you will loads another swf its fonts (with the same name family name) will be substituted by your font with only few symbols.
  2. If you still use static text fields try to load external swf into own application domain (new ApplicationDomain(null)) this will prevent fonts substitution but classes from the main swf will not be available in loaded one.

Upvotes: 1

Related Questions