Embed OTF Font as CFF in Pure Actionscript Project using Flex SDK 4.0

I want to apply the method explained here: http://www.insideria.com/2009/03/flash-text-engine.html using only the Flex SDK 4 (not using FlashBuilder)
Specifically:
Embedding fonts can be tricky. In Flex, embed the font and store it
using DefineFont4 and font subsetting currently only supported by Gumbo.
A future version of Flash will support it but in the meantime, a Gumbo
SWC with the embedded font must be created then adding to your Flash CS4
project.
The following is the method I am using to embed the fonts.
public class Main extends Sprite {
     [Embed(source="../assets/GE Thameen DemiBold.otf",
                              fontFamily = "GE Thameen",
                              fontWeight = "bold",
                              mimeType = "application/x-font",
                              embedAsCFF = "true"
     private const GEThameen:Class;
The following command line was assimilated after solving the output error messages using google and a little looking into how FlashDevelop works..
mxmlc Main.as -load-config config.xml -managers flash.fonts.AFEFontManager
The output SWF is not working as supposed, and the file size (20KB) does not seem to account for the embedded font. PS: When the font embedding is bypassed, and a device font is used for the text engine classes, the file works perfectly.
The contents of config.xml are as the following:
<?xml version="1.0" encoding="utf-8"?>
<!--This Adobe Flex compiler configuration file was generated by a tool.-->
<!--Any modifications you make may be lost.-->
<flex-config>
  <target-player>10.0.0</target-player>
  <compiler>
    <source-path append="true">
      <path-element>E:\actionscript</path-element>
    </source-path>
    <external-library-path>
        <path-element>C:\bin\flex_sdk_4\frameworks\libs\player\10.0\playerglobal.swc</path-element>
        <path-element>C:\bin\flex_sdk_4\frameworks\libs\flex.swc</path-element>
    </external-library-path>
  </compiler>
  <file-specs>
  </file-specs>
  <default-background-color>#FFFFFF</default-background-color>
  <default-frame-rate>30</default-frame-rate>
  <default-size>
    <width>800</width>
    <height>600</height>
  </default-size>
</flex-config>

After losing about 2-3 days to trying to figure this stuff out, I rolled back to build 4.5.0.19786 and the problem doesn't occur anymore.  I'll revisit this issue once we ship the product next week.
Thanks Alex.
Cheers,
Nate Beck

Similar Messages

  • Pure ActionScript project for Adobe AIR

    I've probably missed an obvious button or checkbox somewhere?
    I've seen that when you create a new MXML project, you have
    the option to target it at AIR. How do you do this for a pure
    ActionScript project? (Or import an existing pure ActionScript
    project that was written for AIR?)

    Hi Mister Lafrance,
    But, but it is same problem with creating project after build configure mxml to as. It can to show error - i have tried anything. It can not work while java runtime kills or show a lot of errors. Like this
    Error: ...
    at ...
    at...
    Please make sure my post!!! Sorry we must to configure manuel with RUN/Debug and adding as files....
    Thanks!
    Great nice tutorial! I hope because air developer are happy with Adobe Air Applications.
    Suggestions:
    new functions for executing applications like this flash.system.os.exec or flash.system.exec - If you want to build distributable Air Multi Applications.
    Application Air should to make default directory for important distributing air installers. If you want to work 1 or more application in currect directory.
    Like this:
    /mycompany <- that is root directory was created by frist air installer.
    ./airapps - that new distributing air installer while you after start of air application
    .//airapps/utilities/ <- example Air SDK should to copy into.. or nice air application like this Languagechooser or StyleChooser etc..
    ./airapps/softwares <- your built application like Widget Builder, Splashup or IconGenerater etc..
    ./airapps/config/ <- your currect saved config files. Important: all applications of distributing air applications will to load your currect config like Styles and Languages...
    ./myapp Binary <- create by air installer.
    ./shared/ <- assets,. libraries, templates and more files were created by Air installer.
    Can you make sure for my idea of distributing air applications? We would to talk with new file for Air distributuing packages = *.airdp.
    Thanks and best regards, SnakeMedia

  • Use mx and spark components in pure ActionScript project?

    I'm working on an AIR project in Flash Builder 4, but I'm not using MXML at all (pure ActionScript). Is there a way for me to instantiate and use mx and spark components without MXML? If not, what is the minimal amount of MXML I have to use? FYI, I've already tried all of the following hacks with absolutely no luck:
    http://www.actionscript.org/forums/showthread.php3?t=143062
    http://ersatz.tv/2009/off-topic-flex-components-without-mxml
    http://stackoverflow.com/questions/141288/possible-to-use-flex-framework-components-withou t-using-mxml
    I much prefer ActionScript over MXML. Why does Adobe have such a hard-on for this MXML ****?! It's like all that code and all those great components are going to waste.

    Me too.. . I'm a pure as3 guy and all these components go to waste. You would think they would allow people to generate components via mxml or as3...

  • How to embed custom font (tamil font [ta_IN]) in my android application

    We are developing a mobile application (targeting for android & ios) using Adobe Flash Builder 4.6, Adobe AIR 3.5.  Requirement is to localize the content for indian languages, and rite now we are targeting tamil locale.  We implemented the localization, it is working for the locales where the fonts are available on the device, like french, chinese etc., but not for tamil locale.  As the device doesn't have the font, we would like to embed TTF font.
    After googling on the subject, these are the steps we did to embed tamil font, without any luck.
    1. Used fontswf to convert to SWF
    2. In the main application, we embed the SWF (got the Class reference)
    3. Registered the font
    4. When the locale is changed to Tamil, we are changing the application style (fontFamily) to the Class that we got in Step 2
    PS: Currently we are testing on android devices, however the solution needs to work for ios as well
    Unfortunately, this is not working.  Requesting your help in this regard!

    i am bumping this up. i cannot seem to get this to work on iOS, but was able to get this to work on Android using device fonts.
    Anyone here have expereince dealing with the Tamil language on iOS through AIR?

  • TLF in pure AS3 project?? Big swc woes...

    I'm trying to find any info on using TLF text in a pure AS project (using FDT), but quickly finding myself getting confused by it all.
    My normal workflow when laying out text is to
    - use Flash Pro to lay my text out within a MovieClip,
    - set that MovieClip for export in the library,
    - publish a swc,
    - add that swc to my classpath in FDT so I can add the it to the stage etc.
    Now.. I get the way that if you're using Flash Pro to compile, you end up with the 160kb swz file which is only downloaded by the user if it's not been cached already on their machine. All very clever.
    But... the moment I stick a TLF textfield into a MovieClip and publish a SWC, that SWC is 406kb (which is added to my project when I include the movieclip with the TLF TextField).
    Why so big??? Why is it so much bigger than the 160k that the swz file is??
    Even if I had to embed the TLF framework within my swf I could just about swallow the 160k hit, but 406k is a LOT.
    Am I missing something?

    Okay well I was missing something after all.... I realised that compiling from FDT in Debug mode was causing the big file size. My swf is 578k in Debug mode, whereas if I use Run mode it's only 291k which I can live with.

  • ActionScript Project

    I have an ActionScript Project and I have been running unit tests using the FlexUnit 4 integration in Flash Builder 4 Beta 2. These have been working great until I try to use UIImpersonator, which uses Flex classes and fails in my pure ActionScript project. (UIImpersonator works fine with a Flex Project.)
    Since Flash Builder is for both Flex and ActionScript projects, I figured I would be able to use FlexUnit to equal extents. Is there an ActionScript project equivalent to UIImpersonator, or just a way to access the Stage?

    I found this BDD project page, which includes a stage access example:
    Cuke4AS3 https://github.com/flashquartermaster/Cuke4AS3/
    [EDIT]
    After much research and complication, I ended up using a Singleton that provides a stage reference that was passed in from a `creationComplete` handler in my TestRunner.
    =======TestRunner.mxml==========================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        creationComplete="onCreationComplete()"
        xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
        styleName="flexUnitApplication"
        layout="absolute" height="800" width="1000">
        <mx:Script>
            <![CDATA[
                import org.flexunit.runner.FlexUnitCore;
                private var core:FlexUnitCore;
                public function onCreationComplete():void {
                    core = new FlexUnitCore();
                    core.addListener( new TraceListener() );
                    core.addListener( new UIListener( uiListener ));
                    new StageLocator(systemManager.stage);
                    core.run(MyTestSuite);
            ]]>
        </mx:Script>
        <mx:Style>
            Application {
                   backgroundColor: #3872b2;
                   backgroundGradientColors: #3872b2, #0c1a3d;
                   backgroundGradientAlphas: 1, 1;
                   themeColor: #ffffff;
                   color: #444444;
                   fontFamily: "Myriad Pro Semibold";
                   fontSize: 12;
        </mx:Style>
        <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" />
    </mx:Application>
    =======StageLocator.as==========================================
    package {
    import flash.display.Stage;
    public class StageLocator {
        public static var instance:StageLocator;
        public static var stage:Stage;
        public function StageLocator ($stage:Stage) {
            instance = this;
            stage = $stage;

  • Actionscript project and Scout

    As I understand in order to use Telemetry I have to work with an ActionScript project. But how would I add UI components to this project? Or if I use Loader to load another SWF (with all UIs) will I be able to use Scout to it full power trouble shooting UI problems?
    Thanks

    You only need to enable Telemetry on the main SWF, not on every SWF you load.
    If you have a non-ActionScript project (like Flex), or an existing SWF, or you don't use Flash Builder, then you can enable telemetry on it with this simple tool:
    http://renaun.com/blog/2012/12/enable-advanced-telemetry-on-flex-or-old-swfs-with-swf-scou nt-enabler/

  • Using external libraries with Actionscript Project

    Hi,
    I've hit a bit of a brick wall trying to do something that I figured would be a relatively simple task. I'm working on multiple projects and I'm trying to build a number of SWC libraries shared between a number of Actionscript projects using Flash Builder 4. The projects using the SWC's build just fine, but yield this error when run:
    VerifyError: Error #1014: Class <whatever> could not be found.
    Here's a simple example:
    1) Create a new library project.
    2) Add a new Actionscript file in the "testpackage" package.
    3) Slap this code into that file:
    package testpackage
        public class stuff
            public function Testing():void
                trace("Oh yeah!");
    4) Create a new Actionscript Project named Launcher
    5) In "Properties->Actionscript Build Path", hit "Add SWC Folder" and browse to wherever the library project gets built to.
    6) In the AS file that's generated, add code something like:
    package
        import flash.display.Sprite;
        import testpackage.*;
        public class Launcher extends Sprite
            public function Launcher()
                var s:stuff = new stuff();
                s.Testing();
    7) Run this bad boy.
    I get the above error and I have no idea why. Everything builds fine so I'm not sure what I'm doing wrong. I read somewhere that you can manually extract the .swf file from the generated .swc and load that explicitely in code. This is a pretty horrible workflow and I hope it's not the answer
    Thanks a ton in advance!
    -D

    Check  linkage type in Build Path for project Launcher when you add Swc folder. It has to be merged into code.
    If it is external, you'll see this error.
    That aside, why not do "add project" instead of "add swc folder"?
    -Anirudh

  • Actionscript Projects

    Every example I can find of building an Actionscript Project
    uses the default or root package. I can make those examples work,
    and I can create my own examples that work that way.
    Can someone please show me the sequence of setup operations
    to get an Actionscript Project to work when the code is NOT in the
    default package?
    If there is a correct way to fill in the options with the
    create wizard, great, but if it has to be done by manually creating
    some directory structure, that's fine, too. I will be happy with
    any method of setting up, building and running a simple trace
    ("Hello World") with the HW Class being in some package hierarchy.
    Thank you.

    Hello Rick,
    Go to Flex Builder and select File > New > ActionScript
    project
    Give the project a name and point to the folder where your
    ActionScript source is located.
    Once the project is created, right click on the project in
    the Navigator, and select Properties.
    In the ActionScript Applications section, Remove the default
    AS file created by Flex and Add the main file of the project.
    Click OK.
    You should now be able to build the ActionScript project.

  • Compiler won't embed fonts as CFF

    I've just started working with Flex 4 SDK and the Text Layout Framework. There is one problem I have not been able to solve, no matter what. I am trying to embed a font to use with the new text engine, so it must be embedded as CFF, if I understand correctly. I attempted this, and I get no compiler or runtime errors, but when I check the fontType property of the embedded font, it says 'embedded' instead of 'embeddedCFF'. I am using what I believe is proper embedding code:
    [Embed(source="lacuna.ttf", fontFamily="Lacuna", cff="true")]
    But it won't actually embed it as such, it seems. Here's a zip file with a demonstration of my problem; includes the free Lacuna TTF font, but you may replace that with any other, if you wish to see that this is not an issue with the font itself.
    Regarding the contents of the zip file: I am not using the Flex IDE (or Flash), so I included a Windows batch file to easily compile the Main class, but it must be configured for it to point to the correct Flex SDK path. Don't mind the Label class; it just makes it easy to create a TextLine (from the TLF).
    My problem could be related to this issue, but I'm not using the Flex IDE, and I don't know what RSLs are.
    I'd greatly appreciate anyone who can help me solve this little headache of a problem. I'm very intrigued by the TLF, but I seem to have been roadblocked with this issue.
    edit: Forgot to say: I'm using the 4.0.0 build 7219 version of the Flex SDK.

    Embedding a font does not make it available in Illustrator or any other program. (Exception, Acrobat is able, and must, use the font to correctly draw the page.)
    If there are missing fonts when opening a pdf in Illustrator, the fonts are not installed on the machine.
    As Bob said, "Illustrator is not a pdf editor!". It can, and is abused for such, all to often, with caveats.

  • How to embed a font air Android App????

    Hi, im new to this forum so please forgive me if i question in the wrong section.
    I am Beginner and am working on an air android game in flash cs6.. i need embed fonts please help me sort out htis problem..

    The easiest for me is to simply embed your font into your main document class, like this:
    package
         import flash.display.Sprite;
         import flash.text.*;
         public final class MyApp extends Sprite
              [Embed(source="../fonts/ITCAvantGardeStd-Bold.otf", embedAsCFF = "false", fontWeight="bold", fontName = "ITCAvantGardeStd_DemiAndBold", mimeType = "application/x-font-truetype", unicodeRange="U+0021-U+007E, U+00A9, U+00AE")] // Main characters + Copyright and Registered glyphs
              static public var ITCAvantGardeStdBold:Class; // that's what the embed gets baked into
              Font.registerFont( ITCAvantGardeStdBold ); // do this once per font
              public function MyApp():void // Constructor
                   // Create a textformat that uses the font
                   var tft:TextFormat = new TextFormat( "ITCAvantGardeStd_DemiAndBold", 20, 0xffff00, true );  // size = 20 pix, color is yellow, bold = true, matching the font weight
                   // create a text field
                   var tf:TextField = new TextField();
                   with ( tf )
                        antiAliasType = AntiAliasType.ADVANCED; // optional
                        defaultTextFormat = tft;
                        embedFonts = true; // this is using an embedded font
                        width = 100;
                        autoSize = TextFieldAutoSize.LEFT;
                        wordWrap = true;
                        text = "Hello world ! blah blah blah blah blah blah blah blah blah blah blah blah";
                        height = textHeight + 8; // nice and tight
                        border = true; // for fun
                        borderColor = 0xffff00; // yellow
                   addChild( tf );
         } // end of: class
    } // end of: package
    The embed statement contains several optional properties, like fontWeight, fontStyle, and fontFamily.
    Check here for info:  http://divillysausages.com/blog/as3_font_embedding_masterclass
    Note: Alternatively, you could use Flash Professional to embed the font into the document class via the IDE ( like so: http://www.adobe.com/devnet/flash/quickstart/embedding_fonts.html ).
    Also, for these kinds of questions, I recommend:
    1) O'Reilly -- Essential ActionScript 3.0
    2) O'Reilly -- ActionScript 3.0 Cookbook

  • Accessing a non TTF/OTF font embedded in Flash CS5 SWF via Flex

    Hello,
    I'm trying to embed an older Mac font in a Flash Builder application. I need it to be loaded dymanically for size reasons. I am able to do this with TTF and OTF fonts, but I'm having trouble with other formats.
    I embedded the font in a CS5 FLA, but I can't seem to locate the font when I load the SWF into Flash Builder.
    My function is below. I have it enumerating through the variables in the loaded SWF, but the font I need is not coming up as one of them. I tried, in the FLA, to cast the embedded font to a Class in AS because, but when try to access that variable ("font") after it's loaded, I get null. I also tried setting the embedded font to a Font variable in AS, but I still get null on the other side. Does anyone have any suggestions? Alternate solutions are welcome also.. Thanks!!
            private function loadFonts():void{
                var lc:LoaderContext = new LoaderContext();
                lc.securityDomain = SecurityDomain.currentDomain;
                lc.applicationDomain = ApplicationDomain.currentDomain;
                var ldr:Loader = new Loader();
                ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
                ldr.load(new URLRequest('compatil_bold.swf'),lc);
                function completeHandler(e:Event):void{
                    fontLibrary = e.target.applicationDomain.getDefinition('Compatil') as Class;
                    var varList:XMLList = flash.utils.describeType(fontLibrary)..variable;
                    for (var i:int = 0; i < varList.length(); i++){
                        trace(varList[i].@name+': '+fontLibrary[varList[i].@name]);   
                    Font.registerFont(fontLibrary.font);
                    //Font.registerFont(fontLibrary.CompatilFactBold);
                    trace('font loaded');
                    fontsLoaded = true;
                function ioErrorHandler(e:ErrorEvent):void{
                    trace(e.text);
    in FLA
    var font:Class = new CompatilFactBold() as Class;

    I got it!
    Here is the embedded font in a CS5 FLA:
    That's all you have to do in Flash.
    Here's the function I have in my Flash Builder AS application:
    private function loadFonts():void{
    var lc:LoaderContext = new LoaderContext();
    lc.securityDomain = SecurityDomain.currentDomain;
    lc.applicationDomain = ApplicationDomain.currentDomain;
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    ldr.load(new URLRequest('http://some.other.domain/compatil_bold.swf'),lc);
    function completeHandler(e:Event):void{
    fontLibrary = e.target.applicationDomain.getDefinition('CompatilFactBold') as Class;
    Font.registerFont(fontLibrary);
    trace('font loaded');
    fontsLoaded = true;
    function ioErrorHandler(e:ErrorEvent):void{
    trace(e.text);
    Then you reference the font by its name when you want to use it. In this case: 'CompatilFact LT Bold.'
    update: question is answered.

  • Can I embed OpenType fonts in Flash CS 5.5?

    I just reopened an old-ish Flash project and the fonts aren't working. The project was worked on previously in CS 3 or 4 - don't recall - on a Mac running some earlier version of OS X. I'm currently running Lion and Flash CS 5.5, and some of the fonts aren't embedding or rendering. The project is using Postscript fonts.
    I thought I read that TrueType fonts are more reliable, but the font I need (Akzidenz Grotesk) is not available in TrueType, only OpenType.
    Am I safe to buy and use this in OpenType format? It's several hundred dollars so want to be sure before blowing the money. I think I'm looking at this version, which seems to be the smallest/cheapest I can get away with: http://www.linotype.com/265010/AkzidenzGroteskStdValuePack-product.html
    Thanks!

    Thanks. I'm actually using the Font Embedding panel in Flash. Seems to be working though I can't get any of the variations to work.
    I create a new font in the Font Embedding panel, choose my font and weight (trying Myriad Pro and Myriad Pro Italic), export for actionscript (AS classes fontNormal1 and fontItalic1).
    Then in the class where I do my formatting, up top I have:
    private var fontNormalFont1:String = 'Myriad Pro';
    private var fontItalicFont1:String = 'Myriad Pro Italic';
    In my constructor I have:
    Font.registerFont(fontNormal1);
    Font.registerFont(fontItalic1);
    Then I create my text format:
    fmtMainTitle:TextFormat = new TextFormat();
    fmtMainTitle.color = 0xffffff;
    fmtMainTitle.font = fontNormalFont1;
    fmtMainTitle.size = 18;
    Which I subsequently apply to text fields (including an embed font directive). It works great if my font is fontNormalFont1, but if I try fontItalicFont1 it comes up blank - no text appears.
    I tried creating an instance of the AS class for the italic font, and getting the font name:
    fontItalicInst:Font = new fontItalic1();
    trace(fontItalicInst.fontName);
    And I get back "Myriad Pro" - in other words it's only returning the base font name, not the full name.
    I'm pretty rusty at AS/Flash, and fonts were never my strong suit, so I could be doing all the the wrong way. I do need to have fonts available in CSS, which could be why I'm registering the fonts (it's been a few years since I built this app).
    Would appreciate any advice
    - Bob

  • Embed a font in one SWF use in another?

    Long version:
    I've got a "player" app that I've built that shows content
    from various XML files. I have certain common fonts embedded in it
    (Verdana, Arial, Times, etc.) that it uses to display text. Now,
    I've got a client with a special symbol font that I'll need to pull
    characters from to show specific text in my app. I can't embed this
    font in my app (due to many considerations), but I'd like to use it
    without having to use each character as a graphic (by converting
    every character in the font into a JPG). So, can I embed his font
    in a SWF and load that SWF to use the font in my app?
    Short version:
    SWF1 loads SWF2 which contains an embedded font. SWF1 uses
    that font via a TextFormant instance to show text on the stage.
    Is this possible? My target is Flash 7 player using AS2.
    Thanks!
    Matt

    that approach won't work i don't think. i've looked at shared
    libs before and don't remember it being that useful. but i'll take
    another look.
    is there now way in pure code to do it?

  • How do I embed multiple font outlines in dynamic text field

    Can anyone tell me how I can embed multiple font outlines in
    Flash MX so I can get smooth text in a dynamic
    text frame? I want to use Regular, bold and italic in various
    parts of the text.
    I was using the Character button in the properties manager
    and tried to include all Characters. That does not work.
    In the Properties manager I can choose Bold and/or Italic.
    But it becomes a universal setting that overrides my HTML tags in
    my external txt file that I am importing. I dont want all my text
    to be bold.
    If I dont select them in the properties, however, Flash will
    not embed the font that it needs.
    Is there a different way to embed fonts other than under the
    Character Tab?
    I tried to import fonts to the library, but can not select
    them.
    Your help would really be appreciated.
    Sincerely,
    ggaarde

    ggaarde wrote:
    > Thanks Urami
    > Tried your method and it does not work for me.
    > I put 3 dynamic text fields in the first frame of the
    movie. Set them up to
    > where one is regular, one is bold and one is italic
    Helvetica.
    Weird, it works for me on first go, always had in fact :)
    Show you an example, try to compare to your file see if you
    missed anything accidentally.
    http://flashfugitive.com/stuff/font/text.swf
    text file
    http://flashfugitive.com/stuff/font/text.txt
    fla
    http://flashfugitive.com/stuff/font/text.fla
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

Maybe you are looking for

  • IMac and Macbook can't see each other via Airp

    Except sometimes. Using Leopard on both new machines, I can share Internet connections and printers fine. The problem is in trying to mount volumes or share files. I create a network on the iMac, connect to it on the Macbook, and use the appropriate

  • How do i reset or find out my itunes/app store security code?

    i forgot my itunes/appstore sercirity code, how do i reset or find out what it was?

  • MTT-Communication Error

    Hi all I am trying to do a sync for data for MTR application and I see the following error message in the client and in the NWA (Generic Sync que monitor) "Due to a communications error method WAF_TRIP_GET_LIST could not be executed" How to I trouble

  • Debit credit sheet?

    Hi, I'm sorry if this has been asked already. I tried looking for it with no luck. Is there a simple or advanced debit credit sheet for iWork? If so, where is it, I cant find it. If not, does someone have one they can share or simple instructions on

  • SQL Command and Datetime Parameters

    <p>Hi, </p><p>I am having problems  adding datetime parameters to a SQL command.</p><p>The code is AND table.startdatetime >= '{?start}' </p><p>I enter the time and date in the parameter and get the following error.<br /><br /><strong>Incorrect synta