AS3: Embed specific characters (part.2)

Just as a quick update, I’ve updated the previously created unicode finder app, to be a bit more helpful for the everyday usage.
Here a list of things that have been changed:

  • No double unicodes.
  • Automatic generation of embed code, easy for you to copy & paste directly into your application.

One thing that I can’t handle for you is to define the source of the font with it’s according fontname as defined in your system, but hey if I find a way around this, I will update it.

And again if you would like to play around with it, here the app. Have fun!

Leave a comment

6 Comments.

  1. Hi Tiago,
    Cool app! Did you ever try using the systemFont attribute in your embed tag? I’ve created a Flash CS5 Extension which is a similar to your app, but I had problems filtering out OpenType fonts from the array of fonts that are returned in Font.enumerateFonts() call. The systemFont attribute that’s only supported by the JRE font manager doesn’t support OpenType fonts.

    Check out my Flash Extension if you get a chance: http://blog.johannest.com/2010/06/22/runtime-font-publisher-a-tool-for-runtime-font-sharing/

    Johannes

    P.S. Congrats on the new book!

    • Hi Johannes, thanks for your comment, great extension you wrote there.
      Will have a closer look at it during the course of the week..
      I’ll be extending my app in the near future as I got a ton of feedback and new ideas to work on.. By any chance do you know how to read the real filename of the font?
      I’ve been thinking about that for a while, besides of using FileReference to have a look at it, I haven’t came up with any other solution.

  2. As my extension is running in the Flash authoring environment it has access to JSFL, which I use to get the file name and file path. You could make your app an AIR app and use the flash.fileSystem API to get the file name.

    To get the font family name, I’m using this open source library. Might also be worth it for you to check it out: http://www.sephiroth.it/file_detail.php?id=159

  3. Yeh I had a quick look at it, hope to get some free time soon so I can continue the development of it.
    Thx for your hint ;)

  4. I need help,I am under flash CS4 As3 I use the flex lib for embed Arabic fonts.
    but The characters are back to front:
    package {

    import flash.display.MovieClip;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.Font;
    import flash.text.TextField;

    public class GIFEmbed extends MovieClip {

    [Embed(source='Maghribi.TTF', fontFamily='foo', fontStyle = 'regular', unicodeRange='U+0627,U+0644,U+062c,U+0645,U+0639,U+0629')]

    public var bar:String;

    public function GIFEmbed() {

    var format:TextFormat = new TextFormat();
    format.font = “foo”;
    format.color = 0xFF0000;
    format.size = 50;

    var label:TextField = new TextField();

    label.embedFonts = true;
    //label.autoSize = TextFieldAutoSize.LEFT;
    label.antiAliasType = AntiAliasType.ADVANCED;
    label.setTextFormat(format);

    label.defaultTextFormat = format;
    label.text = “الجمعة”;
    label.width = 200;
    addChild(label);
    }
    }
    }

    can I have you email to send you the files??

    thanks for your help

  5. Hi Med, sorry to tell you but there is no proven way to use arabic font in CS4 if your machine is not setup in arabic. Best you can do for now is get the trial of Flash CS5 and use the new Text Engine (TLF) unless you want to get dirty with it and use TLF codewise, which is not that easy if you need to go wild with the text..
    http://opensource.adobe.com/wiki/display/tlf/Text+Layout+Framework

Leave a Reply

Your email address will not be published.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">