AS3 Oplossing voor Embedding Fonts Not visible: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
[Embed(source="Verdana.ttf", embedAsCFF= "false", fontFamily="_Verdana")]
[Embed(source="Verdana.ttf", embedAsCFF= "false", fontFamily="_Verdana")]


Another option, if you do not want to change all of your [Embed] tags, is that you can edit the
Another option, if you do not want to change all of your [Embed] tags, is that you can edit
FlexInfo.xml file copied into your user local settings directory  
the FlexInfo.xml file copied into your user local settings directory
(e.g. C:\Users\taljaber\AppData\Local\Adobe\Flash CS5\en_US\Configuration\ActionScript 3.0\FlexInfo.xml for me on win7)  
(e.g. C:\Users\taljaber\AppData\Local\Adobe\Flash CS5\en_US\Configuration\ActionScript 3.0\FlexInfo.xml for me on win7)  
and edit that file by uncomment the line that sets the compatibility version to 3.0 at the
and edit that file by uncomment the line that sets the compatibility version to 3.0 at the
end of that file. I'm not sure what other side effects this change might have, but it definitely
end of that file. I'm not sure what other side effects this change might have, but it
forces all embedded fonts to be embedded as DefineFont3 tags.
definitely forces all embedded fonts to be embedded as DefineFont3 tags.





Revision as of 13:25, 15 August 2011

Embedding Probleem in CS5

If font embed metadata stopped working “not showing the font when test movie or publish ”

in Flash CS5 when it used to work just fine in Flash CS4 that’s because Flash CS4 embeds

DefineFont3 tags while Flash CS5 embeds DefineFont4 tags. DefineFont4 is mainly used with

TLF to to selectively embed glyphs from a font for use in Text Layout Framework(TLF), also

known as font subsetting while DefineFont3 is more for classic fonts.

There are a few ways to fix this problem. First, there is an optional parameter to the [Embed] tag for fonts that specifies which type of font tag to create. Add embedAsCFF="false" to the list of parameters in the embed tag to do this.

[Embed(source="Verdana.ttf", embedAsCFF= "false", fontFamily="_Verdana")]

Another option, if you do not want to change all of your [Embed] tags, is that you can edit the FlexInfo.xml file copied into your user local settings directory

(e.g. C:\Users\taljaber\AppData\Local\Adobe\Flash CS5\en_US\Configuration\ActionScript 3.0\FlexInfo.xml for me on win7) and edit that file by uncomment the line that sets the compatibility version to 3.0 at the end of that file. I'm not sure what other side effects this change might have, but it definitely forces all embedded fonts to be embedded as DefineFont3 tags.


I would recommend updating the [Embed] tag for fonts to do embedAsCFF="false".


(bron: http://flashauthoring.blogspot.com/2010/10/font-embedding-tip.html)


package {
	
import flash.utils.describeType;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
  
   public class Test extends MovieClip {
    
      // be sure this is pointing to a ttf font in your hardrive
      [Embed(source="SamsungModernCondensed.otf", embedAsCFF= "false", fontFamily="foo", mimeType="application/x-font-truetype")] 
      public var bar:String;
      			
      public function Test() {
                	
          var format:TextFormat	      = new TextFormat();
          format.font		      = "foo";
          format.color                = 0x000000;
          format.size                 = 60;
						
          var label         = new TextField();
          label.embedFonts            = true;
          label.autoSize              = TextFieldAutoSize.LEFT;
          label.antiAliasType         = AntiAliasType.ADVANCED;
          label.defaultTextFormat     = format;
          label.text                  = "Hello World!";
          addChild(label);
       }
    }
}