Hi,

I have a font problem. In a project i use dinamically loaded embedded fonts
with a wrapper class. Everything works fine, but some accentuated letters
are wrong. This is font specific, with Vonnes type on the little " í ". 
Any idea?
thanx
Horváth Balázs

link to the swf:
http://www.flexware.hu/FontLoader.html

the source:

/*
 *
 * _Arial.as
 *
 */
package {
     import flash.display.Sprite;
     public class _Arial extends Sprite {
          [Embed(source='arial.ttf', fontName='myFont')]
          public static var _Arial:Class;
     }
}


/*
 *
 * FontLoader.as
 *
 */
package {
     import flash.display.Loader;
     import flash.display.Sprite;
     import flash.events.Event;
     import flash.net.URLRequest;
     import flash.text.*;

     public class FontLoader extends Sprite {

          public function FontLoader() {
               loadFont("_Arial.swf");
          }

          private function loadFont(url:String):void {
               var loader:Loader = new Loader();
               loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
fontLoaded);
               loader.load(new URLRequest(url));
          }

          private function fontLoaded(event:Event):void {
               var FontLibrary:Class =
event.target.applicationDomain.getDefinition("_Arial") as Class;
               Font.registerFont(FontLibrary._Arial);
               drawText();
          }

          public function drawText():void {
               var tf:TextField = new TextField();
               tf.defaultTextFormat = new TextFormat("myFont", 16, 0);
               tf.embedFonts = true;
               tf.antiAliasType = AntiAliasType.ADVANCED;
               tf.autoSize = TextFieldAutoSize.LEFT;
               tf.border = true;
               tf.htmlText = "Dinamikusan beágyazott font \n\
nárvíztűrő ütvefúrógép \n\n ÁRVÍZTŰRŐ ÜTVEFÚRÓGÉP";
               addChild(tf);
          }
     }
}



Reply via email to