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 2: Line 2:


If font embed metadata  stopped working “not showing the font when test movie or publish ”
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
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
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
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.
known as font subsetting while DefineFont3 is more for classic fonts.



Revision as of 13:24, 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);
       }
    }
}