Embedding As3 Fonts

I saw a lot of questions related to embedding fonts in flash, and I can not find the answer to my problem.

I download fonts from the swf font and register them at a high level so that they can be used in child swfs. The problem is that the child swf can also embed these fonts, but clearly not, that is, they are only embedded, because the child swf has fields that use certain font characters. This means that the text fields in the child use an incomplete built-in font instead of the built-in full set, which is registered at the parent or any level of grandparents. This also means that swfs, which can become children of this child, will not receive the full font.

My question is: Is there a way to tell flash when compiling, so as not to insert, under any circumstances, fonts in swf? If there is no tool that removes embedded fonts from compiled swf?

Here are a few things that I thought / noticed:

  • It seems that every Font class is tied to ApplicationDomain. (A confirmation of this would be helpful)
  • Using device fonts in text fields will not embed fonts. (Not an option for me, because I need fields to embed fonts at runtime from the parent swf.)
  • I can’t find a way to unregister the fonts or simply tell downloaded swfs to use parent fonts, which would be useful to apply to downloaded child swfs.
  • It might be possible to load the child in a different context that would allow parent font definitions to override child element definitions. (Or would there be two definitions, and if so, which one takes precedence?)
  • Downloading assets from the child’s library and adding them to the scene will receive the parental font definition. (this makes sense because the asset was created outside the domain of the child).
  • A possible solution might be to not add any characters to the text fields to compile swf, but this is not an option, because I need static text using any font.

I began to formulate a definition that the problem in my mind may be wrong, so please take a few steps back if necessary and give me a different point of view on the problem. It still seems that the question I asked above is the right question to answer, and if there is a solution, all my problems go away.

Thanks!

+6
source share
3 answers

Turns out this is a bug with my version of Flash Professional. Now I have done the update, and now common generic fonts are available. I will probably point to a generic font with a bad URL for the fonts, then the fonts will come from the parent domain of the application, because they are not compiled into child swfs. Now I am using Flash Professional CS5.5 11.5.1. I used CS5.5 11.5.0.

http://forums.adobe.com/message/3926344

Thanks Adobe for wasting my time.

0
source

If I am right in understanding, do you want to unregister / unregister all fonts that are not as complete as the version of this particular font that has already been downloaded but built into another swf?

Each built-in font creates a class, each swf that you load through the Loader class is loaded by default into its own application domain to prevent namespace conflicts, but you can force the loader to load everything into the current application domain using the "loader context" parameter Loader load (). Thus, you can try to force classes to be redefined in the same namespace with each other, but with what you cannot control which class should be discarded, you cannot check which font has more glyphs. (maybe it just throws errors instead of overriding and does not start at all, I'm not sure about that).

On the other hand, you should ask a question about how fonts are actually embedded in child swf files. I don't know any other way than embedding fonts like:

in * .fla-files as a "library symbol", or in flashbuilder or flex code as follows: [Embed(source="c:/windows/fonts/verdana.ttf", fontFamily="Verdana", embedAsCFF="false")] ,

or that:

 @font-face { src: url("../assets/MyriadWebPro.ttf"); fontFamily: myFontFamily; advancedAntiAliasing: true; } 

in mxml files. Thus, (this is what I think) the resulting name of the generated class depends on the "font-family" property (or even more settings) set by the developer, which means that even if the same font is embedded twice in the name class, differ depending on the settings.

There is also no Font.unregisterFont() method, so how to manage this remains a good question, in case you somehow find the same font class (maybe RegExp becomes a friendly helper).

I think that for the correct solution you need to control at compile time using .xfl-based xml project files, perhaps even if the mentioned Font-File may have a different name.

Good problem luck

0
source

I had a lot of problems using flash fonts. This is still a problem with html with different browser renderings in different ways.

In any case, for flash, I created this toolkit, which helps me a lot. Check how to customize the fonts. If you follow the steps, I am sure that the problem will be resolved.

https://github.com/tbwa/AS3-Toolkit/tree/master/src/com/utils/text

0
source

Source: https://habr.com/ru/post/928146/


All Articles