Embedding fonts in Flash 8?

Hi,
I have a Flash file and it uses Mac fonts, however, I work
much better using Windows. I'd like to do my Flash development on a
Windows machine, but I need to use the Mac fonts. Say buying these
fonts for Windows is not an option...can I embed a font within the
FLA so I can develop on Windows and render the SWF with the Mac
fonts?
I'd like to be able to open the FLA on the Mac, do the
embedding steps, save the FLA and transfer it over to the Windows
machine and develop there.
Thanks in advance
P.S.
If possible, I'd like to do this via the library or similar,
not through AS code.

B0st0nMark;
No, you cannot embed a working font in a fla (or any native
graphics
format to my knowledge)--fonts are often protected/licensed.
Even if you
could embed a useable font, flash would then also need to
convert the font
to be windows compatible in your case... -Tom Unger

Similar Messages

  • Does Embedded Fonts in Flash Builder 4 work?

    Does emmbedded fonts actually "work" (display) in Flash Builder 4?
    Reason I am asking, I tried to embed fonts in Flex 3, but no success.
    FYI:
    It was an open license True-Type Font.
    I followed this tutorial
    http://carvalhar.com/#/en/blog/190/embedding-fonts-flex/
    Also, Adobe's Flex in a Week videos.
    Used this function:
                private function displayEmbeddedFont(name:String):void
                    var font:Object = systemManager.embeddedFontList[name];
                    Alert.show(ObjectUtil.toString(font), name + ":");
    To determine if the Font was embedded, and the font was "embedded".
    However, the font was not display.

    Try http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/
    I also answered in your other thread, http://forums.adobe.com/thread/482315.
    Let us know if you're still having problems and we can try and help you get started.
    Peter

  • How can I write Arabic font in flash?

    How can I write Arabic font in flash?
    I have a project and I need to write dynamic text (Arabic).

    hi frankie*,
    Please try this, there are some difference with your code: 
    http://actionscriptexamples.com/2008/11/24/embedding-fonts-in-flash-cs4-using-actionscript / 
    // ActionScript 3.0
    [Embed(source="assets/ARIAL.TTF", fontFamily="ArialEmbedded")]
    var ArialEmbedded:Class;
    var arialEmbeddedFont:Font = new ArialEmbedded();  
    var textFormat:TextFormat = new TextFormat();
    textFormat.color = 0xFF0000;
    textFormat.font = arialEmbeddedFont.fontName;
    textFormat.size = 32; 
    var textField:TextField = new TextField();
    textField.autoSize = TextFieldAutoSize.LEFT;
    textField.wordWrap = true;
    textField.defaultTextFormat = textFormat;
    textField.embedFonts = true;
    textField.text = "The quick brown fox jumps over the lazy dog.";
    textField.width = 500;
    textField.x = 25;
    textField.y = 25;
    addChild(textField);
    Hope it helps.

  • How to use embedded font (CFF) for Flash CS4?

    Hi,
    I am trying to embed "Arial Unicode MS" for use by TLF in my Flash CS4 project. As I googled around, I am using the "Flex SWC" approach, only not having any luck. Here is what I got:
    //Code in Flex ActionScript project:
    package
        public class FontEmbeds
            [Embed(source='C:/Windows/Fonts/ARIALUNI.TTF',
                    fontFamily='ArialUnicodeMS',
                    embedAsCFF='true'
            public const Font1:Class;
    When I am trying to instantiate this class, I have AS code in my Flash main timeline:
    var font:Font = new FontEmbeds_Font1();
    Flash compiler says: "1067: Implicit coercion of a value of type FontEmbeds_Font1 to an unrelated type flash.text:Font."
    Ok. Now after I changed it to:
    var font:FontEmbeds_Font1 = new FontEmbeds_Font1();
    Flash gives 3 errors:
    "VerifyError: Error #1014: Class mx.core::FontAsset could not be found.
    ReferenceError: Error #1065: Variable TextLayout is not defined.
    ReferenceError: Error #1065: Variable MainTimeline is not defined."
    I am assuming I have to create a Font1 object in order to use the embedded font. Is this assumption correct? As I've tried to use the "fontFamily" directly but Flash didn't seem to find the font at all:
    charFormat.fontFamily = "ArialUnicodeMS";
    Thanks.

    Hi Eric,
    Thanks for the info.
    I've tried to use the "fontFamily" directly but Flash didn't seem to  find the font at all:
    charFormat.fontFamily = "ArialUnicodeMS";
    In one fla where I used pure TFL, nothing gets rendered at all in the container Sprite. Flash doesn't throw any errors either. In another fla where I used a ComboBox, etc. along with TFL, it throws an error says it can't compile since "there is no ActionScript found" and I got a screen where all the Flash components were  flickering. After several attempts, Flash crashed.
    Also as a side note, the swc gets generated by Flash Builder Beta 2, at first it was 18mb and the second time I complied it become 9mb and stayed 9mb afterwards. Not sure if that's a concern.
    Geng

  • Embedded a korean font in Flash

    Hello !!!
    I would like to embedded a font thanks Flash CS3, in order to
    get a .swf that handle the italic and bold korean font (is
    possible, one that looks like lucida for the latin characters).
    I’ve tried several that seemed to handle the korean but each
    time I end with square characters when I test it :( Furthermore I
    couldn’t find the fonts given in this post (
    http://typophile.com/node/19036).
    I also have corectly "embedded" the special characters on flash..
    still not work !!!
    Does somebody has an idea where I could find a character
    table or directly which font use for korean or where to find .swf ?
    Thanks a lot !!

    I have created an English brochure for a client, and the same brochure was translated into German. Now I am being asked for a Korean version. Can someone provide some guidance on how best to proceed in Adobe Indesign CS5? I gather that I use Apple Gothic or another font... but it doesn't show up as Korean. Also, is Korean a vertically read font?
    Korean is occasionally set vertically, but it's an extremely old-fashioned technique outside of a few limited areas - some ads, the spines of books, et cetera. 
    To be honest, I'd say "package your InDesign file and send it to a firm or freelancer that specializes in English to Korean translation, with experience in the subject matter of your brochure." It sounds like you are asking for automated machine translation within InDesign; ID has no such ability. There are ways to flow automated machine translations into ID documents, but you're most likely to find those tools in the hands of translation agencies anyways.
    No matter where you get your translation done, I'd advise against you trying to typeset the Korean yourself - there are issues with Korean in English-language ID. Without some careful setup, ID will treat Korean characters as if they were Chinese, and will break Korean words in incorrect locations instead of at spaces.

  • Flash 8 embedded font sizes are larger?

    Hi,
    Quick question,
    I have a fla that only stores embedded fonts that I use
    throughout the site to reduce overall filesize. I noticed that if I
    export for Flash 8 the swf is about 75% larger than if I export for
    7. Anybody happen to know why? What will I be "missing out on" if I
    continue to export for Flash 7?
    Thanks alot!

    Page 162 of the user manual here lists the following built-in fonts for the US version:  
    CG Times, CG Times Italic,
    Universe, Universe Italic,
    Courier, Courier Italic,
    Letter Gothic, Letter Gothic Italic
    Other fonts would be provided by your operating system.  What is your operating system?  What application are you printing from?
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Flash animation in Captivate - Embedded fonts not displaying.

    I'm in Captivate 5 creating a lesson, I have made a simple animation in Flash 5 that contains one word in the animation. I output it from Flash to a .swf. Before I output it I set the font (Arial) to embed. It previews fine, when I view the small library review animation in C5 it appears fine. When I F10 to preview the slides, the font has reverted to a default system font. Any idea why the embedded font would not display properly when I do a 5 slide preview in Captivate?
    Best, Steve

    Check out this thread:
    http://discussions.apple.com/click.jspa?searchID=4541194&messageID=5729015

  • Unable to load embedded fonts in Textlayout Framework using SWFContext.

    Hi,
        We are having issues with embedding/renderring fonts in swf.
        Here is the code of the slide1.swf compiled by mxmlc.exe [Adobe Flex Compiler (mxmlc) Version 4.1.0 build 16076] with compiler parameters --  "-static-link-runtime-shared-libraries".
    and checked with  Flash player version 10.1 and 10.2 and 10.3.
        package
            import flash.display.Sprite;
            import flashx.textLayout.compose.ISWFContext;
            public class Slide1 extends Sprite implements ISWFContext
                [Embed(source="C:/WINDOWS/FONTS/CALIBRI.TTF", fontName="Calibri", embedAsCFF = "true", unicodeRange="U+0041,U+0072,U+0069,U+0061,U+006C,U+0020,U+004E,U+006F,U+006D", mimeType="application/x-font")]
                public static const calibri:Class;
                [Embed("slide1/sldBg1.png", mimeType="image/png")]
                public static const bg:Class;
                [Embed("slide1/slide1.xml", mimeType="application/octet-stream")]
                public static const slide:Class;
                public function callInContext(fn:Function, thisArg:Object, argsArray:Array, returns:Boolean=true):*
                    if (returns)
                    return fn.apply(thisArg, argsArray);
                    fn.apply(thisArg, argsArray);
        Using Flex 4.1 SDK:--
            When I load the slide1.swf in ActionScript Project it shows the embedded text.
            But, when I load the slide1.swf in  MX+Spark Flex Project, it gives an error :
            Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
           Error TypeError: Error #1034: Type Coercion failed: cannot convert Slide1@f56fce9 to mx.core.IFlexModuleFactory. !
            Below red colored text is the code where the exception occurs.
            var fontClass:Class = ApplicationDomain.currentDomain.getDefinition("slide1") as Class;
          textFlow.flowComposer.swfContext = new fontClass();
            textFlow.flowComposer.addController(new ContainerController(textContainer, containerWidth, containerHeight));   
            textFlow.flowComposer.updateAllControllers();           
            And, when I load the slide1.swf in Only MX Flex Poject, it shows the embedded Font.
        Using Flex 4.5 SDK:--
            With MX+ Spark and MX only Flex Project we get following errors
            VerifyError: Error #1053: Illegal override of createGeometry in flashx.textLayout.elements.FlowGroupElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.SubParagraphGroupElement.
            VerifyError: Error #1103: Class flashx.textLayout.elements::LinkElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of display in flashx.textLayout.elements.ContainerFormattedElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.FlowLeafElement.
            VerifyError: Error #1053: Illegal override of addParaTerminator in flashx.textLayout.elements.SpanElement.
            VerifyError: Error #1053: Illegal override of canReleaseContentElement in flashx.textLayout.elements.InlineGraphicElement.
            VerifyError: Error #1053: Illegal override of minPercentValue in flashx.textLayout.property.NumberOrPercentProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.EnumStringProperty.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.BooleanProperty.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.NumberProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberProperty could not be found.
            VerifyError: Error #1053: Illegal override of minValue in flashx.textLayout.property.IntProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::IntProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.UintProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::UintProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.StringProperty.
            VerifyError: Error #1014: Class flashx.textLayout.property::NumberOrPercentProperty could not be found.
            VerifyError: Error #1053: Illegal override of hash in flashx.textLayout.property.ArrayProperty.
            VerifyError: Error #1103: Class flashx.textLayout.elements::TCYElement cannot extend final base class.
            VerifyError: Error #1053: Illegal override of createTextLine in flashx.textLayout.compose.ComposeState.

    Hi Jin-Huang
              But when I use Simple ASProject with SDK 4.1 then it works fine but when I create Flex project then it give error
    with SWFContext.
    I think it's a issue of swfcontext or AS comunication with Spark components.
    Please let me know if any solution.
    Thanks

  • Spark DataGrid Embedded Font Quandary

    01.  In everything that follows, I am talking about the latest [21328] version of the SDK, not that I believe that my problems have anything to do with that release, just so anyone interested and willing to help will know the version.
    02.  My application happens to be rooted in AIR's WindowedApplication, but again, I do not think that has any impact on my problems; I believe the same results would obtain for a Flex Application.
    03.  I have a custom renderer for the Spark DataGrid which extends DefaultGridItemRenderer.  It works fine. Its primary job is to change the font characteristics of each row in the list as a visual clue to the user as to the specific nature of the content that is accessible.  Some entries are just in the Regular font, some in Bold, some in Italic, and some in Bold-Italic.
    04.  I have, for most of the project, embedded the necessary fonts like this:
        [Embed (source="C:/Windows/Fonts/ArnoPro-Caption.otf", fontName="ArnoPro_BI_4",
            fontStyle="italic",
            fontWeight="bold",
            mimeType="application/x-font",
            embedAsCFF="true",
            unicodeRange="U+0021-U+00ff, U+20ac-U+20ac")]
        private const ArnoPro_BI_4:Class;
    As I said, that all works just as advertized.  But, that method of embedding carries the somewhat painful burden of slower compilations, so for the last 24 hours I have unseccessfully been trying to replace that with:
    [Embed (source = "../resources/assets/ArnoPro_BI_4.swf", symbol="ArnoPro_BI_4")]
    private const ArnoPro_BI_4:Class;
    where the swf file was produced via fontswf, using this incantation:
    fontswf -4 -u U+0021-U+00ff,U+20ac-U+20ac -b -i -a ArnoPro_BI_4 -o ArnoPro_BI_4.swf C:/Windows/Fonts/ArnoPro-Caption.otf
    06.  By all that is holy, the two different means of embedding the font ought to yield the same result, but they do not.  I have debugging code inserted to print out the list of fonts upon initiation of the application, and they are identical.  Both means of embedding do succeed in getting the embedded fonts into the .swf, but the attempt to use the fonts fails using the second approach.
    There is, of course, no change being made to the code in the item renderer which merely uses setStyle() to effect the row-by-row result.  The result in the second case is that the only style of the embedded font that renders is 'regular'.
    07.  I have used the 'keep-generated' facility to look at the code being generated by the mxmlc compiler and can see that different code is emitted, but it does not help me find a fix to the problem.  Both forms of the meta-tag do something; both methods of embedding seem to correctly register themselves with the FontManager, but only the method of embedding which actually performs the transcoding during compilation seems to result in a set of registered fronts which can be found and correctly used to render output based on the runtime setting of the font style.

    Thank for the reply
    I hoped that my posting indicated how the fonts in the the .swf file were constructed.  The "-4", argument to the command-line tool, fontswf, as far as I can tell, is the precise analog to the "embedAsCFF" argument in the [Embed] syntax.  That is what makes it so perplexing.  Given all the external documentation that is available for each tool/methodology, I would have thought that the resultant bytecodes, classes, flags, whatever, would have been identical.  The only difference would be the timing of when the transcoding took place.
    Since it is clearly more efficient to only transcode whatever set of fonts an application needs once, not once per build/test turn-around, I would really like to make the fontswf workflow work.  For those of us outside the beneficial environment of your licensed tools, the kindly-provided alternative to the facilities built into Flash Professional and/or Flash Builder give us the greatest degree of productivity.
    Whoever has access to the source code for Font [I can only see the uninteresting FontAsset in the SDK] can probably determine what difference might result from mxmlc working with this intermediate output, when inline transcoding is 'tagged':
    package
    import mx.core.FontAsset;
    [ExcludeClass]
    [Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1189", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
    public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
        public function AIRZoom_ArnoPro_IT_4()
            super();
    versus this, when swf extraction is 'tagged':
    package
    import mx.core.FontAsset;
    [ExcludeClass]
    [Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1191", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
    public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
        public function AIRZoom_ArnoPro_IT_4()
            super();
    The only difference is that value for '_line' which probably only indicates that one of the two processes has a comment or empty line somewhere.

  • Embedding fonts

    I'm a bit confused about embedding fonts. I have Flash CS5, which the help files say automatically embeds fonts.  But then the files go on to describe how to embed fonts, as if it needs to be done.  Do I need to embed fonts for files made with Flash CS5?
    The reason I ask is that when I replace text fonts in the template I'm modifying, the font changes its appearance, even though it says it is the same font as the one that came with the template.  The font is Tahoma regular 11pt.
    I tried embedding the Tahoma font, but I'm not sure I'm using the embed process correctly.  For one thing, it doesn't seem to have many fonts you can embed. Tahoma isn't listed.  When I enter text, it looks awful -- low resolutions, bad justification, ragged edges.
    I have a MacBook Pro running leopard.
    Than you for any help you can give.
    Best -- Catherine

    I'm new enough to Flash that I don't fully understand what you wrote above. Is a static textfield one in which letters remain stationary? And by the characters actually used in the specified textfield, do you mean the characters I enter or the ones already there? In other words, if I enter letters that weren't used for that field in the template (eg, my name instead of the generic name), will they all be embedded?
    I'm not sure embedding is the problem. I think I've done it. At least, Tahoma 11pt is now one of the fonts listed in the embed menu when I bring it up.
    But the font looks awful. It is supposedly the same one as in the template, but it doesn't look the same. The size, resolution, and spacing are all bad, whereas in the template they look nice. It doesn't happen until I actually go into an element in Flash and change text. It essentially seems to "reset" the text to a new font that looks bad and doesn't space out properly.
    Thanks for any help you can give me with this!
    Best -- Cat

  • A lot of time waisted on embedding fonts! Please advise!

    I am trying to embed this (attached) font for the second day! I know that it is not how it should be. Please help me if you know how.
    This is Mac.
    I added this font in Flash library and also created a dynamic field with it and embedded it from there.
    Then in Flash Builder (original SDK 4.0):
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/halo";
    @font-face
        src: url("assets/fonts/fonts.swf");
        fontFamily: "12 pt. Helvetica* 75 Bold   07472";
        embedAsCFF: true;
    .redHeader
    font-family: "12 pt. Helvetica* 75 Bold   07472";
    font-size: 20;
    color: #9e0b0f;
    It compiles without errors, but instead of this font it uses some default font.

    it says:
    transcoding parameter 'embedAsCFF' is not supported by 'flex2.compiler.media.MovieTranscoder' 
    however I am using in on spark:Label.
    [Embed(source="assets/fonts/fonts.swf", fontName="Myriad Pro Bold")]
    public static var myriadProFont:Class;
    compiles and finds the font but later on
    .redHeader
        font-family: "Myriad Pro Bold";
        font-size: 20;
        color: #9e0b0f;
    assigned to the label is not working.
    Straight inclusion through embed tag is working for this font.
    May be something wrong with embedding into swf, but in this case flex wouldn't find it and would give an error.

  • How do i embed fonts in flash builder 4?

    how do i embed fonts in flash builder 4?
    thanks,
    daniel

    Try http://blog.flexexamples.com/2008/10/15/embedding-fonts-in-flex-gumbo/
    I also answered in your other thread, http://forums.adobe.com/thread/482315.
    Let us know if you're still having problems and we can try and help you get started.
    Peter

  • Missing characters in CFF embedded fonts

    Our application loads embedded fonts on the fly. I'm in the process of converting our text handling to FTE and switching over to CFF fonts, but I've noticed that for a couple of fonts, there are characters that are damaged, or missing entirely. The same text renders correctly when the font is installed as a system font, and also when it's embedded in the non-CFF format, so CFF embedding is choking on something, but I have no idea what. Nor do I see a lot of knobs that I can twist to control the CFF output.
    For example, Budmo Jiggler (http://www.dafont.com/budmo-jiggler.font). When embedded as CFF, the letter "B" isn't rendering correctly:
    This occurs in both the 10.3 and 11.3 players.
    My embedding code is autogenerated for all fonts and looks like this:
    // GENERATED FILE - DO NOT EDIT
    package {
         import flash.display.Sprite;
         import flash.text.Font;
         [SWF(width="800", height="600", backgroundColor="#FFFFFF", frameRate="30")]
         public class BUDMO extends Sprite {
              [Embed(source='/Users/bsharon/src/Bueller/as/fonts/ttf/Budmo Jiggle/BUDMO.ttf',
                     mimeType="application/x-font",
                     fontName='embedded_BUDMO',
                     unicodeRange='U+0000-U+00FF',
                     embedAsCFF='true',
                     fontWeight='normal',
                     fontStyle='normal')]
              public static var embedded_BUDMO:Class;
              [Embed(source='/Users/bsharon/src/Bueller/as/fonts/ttf/Budmo Jiggle/BUDMOB.ttf',
                     mimeType="application/x-font",
                     fontName='embedded_BUDMO',
                     unicodeRange='U+0000-U+00FF',
                     embedAsCFF='true',
                     fontWeight='bold',
                     fontStyle='normal')]
              public static var embedded_BUDMO_Bold:Class;
                trace("Registering font embedded_BUDMO");
                Font.registerFont(embedded_BUDMO);
                trace("Registering font embedded_BUDMO_Bold");
                Font.registerFont(embedded_BUDMO_Bold);
    The code is compiled like so: mxmlc --static-link-runtime-shared-libraries -output <swf_file> <as3_file>. There are no warnings.
    So...what do I try next?

    I will close my own question by saying that if I convert the TTF files to OpenType, the problem goes away. I would have preferred not to bang my head on this particular wall, but at least I have a workaround now.

  • 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

  • Module not unloading if embedded font was ever used

    So, I have a test app that uses modules with the font embeded. Using ModuleManager I am able to load up the module. Once I call   IModuleInfo.factory.create(), I am then able to setStyle("fontFamily", "BPDiet") and the font does show up. The issue I am now having is that once I have used a font from a module, even if my TextArea is no longer using it (I even tried removing the textArea, and replacing it with a new one), the module will not unload.
    I read through this "What We Know About Unloading Modules" and I think I am not leaving any references around.They are loaded using the load() defaults. There is no code (that is used) in the module. The modules are not being added to the display, so they never receive focus.
    Note that I am unable to run the profiler as suggested in the article as I don't have the premium Flash Builder 4. <grrr>
    Note that the first module that is loaded, I can never get to unload, even if I never used the font embedded in it, but all subsequent modules will unload, if I do not use the embedded font. I can live with the first one being pinned as long as I can unload the others that are not in use.
    Here is the code from one of my modules:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import spark.components.TextArea;
                [Embed(source='assets/BPDiet.otf',
                        fontName='BPDiet',
                           mimeType='application/x-font')]
                public static var BPDietNormal:Class;
                public function GetSampleTextArea():TextArea {
                    var SampleTextArea:TextArea = new TextArea();
                    SampleTextArea.text = "Test BPDiet please!";
                    SampleTextArea.setStyle("fontFamily", 'BPDiet');
                    return SampleTextArea;           
            ]]>
        </fx:Script>
    </mx:Module>
    And here is the App that is loading and using the modules:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="400" minHeight="400">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.core.UIComponent;
                import mx.events.FlexEvent;
                import mx.events.ModuleEvent;
                import mx.managers.SystemManager;
                import mx.modules.IModule;
                import mx.modules.IModuleInfo;
                import mx.modules.Module;
                import mx.modules.ModuleManager;
                import spark.components.TextArea;
                private var _ta:TextArea = null;
                protected var _moduleInfo:IModuleInfo;
                private function LoadFontTextArea(fontSwf:String):void {
                    status.text = "Loading the font pack";
                    _moduleInfo = ModuleManager.getModule(fontSwf);
                    // add some listeners
                    _moduleInfo.addEventListener(ModuleEvent.READY, onModuleReady);
                    _moduleInfo.addEventListener(ModuleEvent.ERROR, moduleLoadErrorHandler);
                    _moduleInfo.addEventListener(ModuleEvent.UNLOAD, moduleUnloadHandler);
                    _moduleInfo.load();
                private function onModuleReady(event:ModuleEvent):void {
                    status.text = "The font pack swf Ready \n" + event.module.url;
                    //All I had todo was create the module, then I could access the embeded font by name
                    var fontMod:* = event.module.factory.create();
                    //_ta = fontMod.GetSampleTextArea();
                    //panelToStuff.addElement(_ta);
                    fontMod = null;
                    //fontNameForSample = event.module.url.replace(".swf", "");
                private function moduleLoadErrorHandler(event:ModuleEvent):void {
                    status.text = "Font Module Load Error. \n" +
                        event.module.url + "\n"+ event.errorText;
                private function moduleUnloadHandler(event:ModuleEvent):void {
                    status.text = "Font Module Unload Event. \n" + event.module.url;
                private function fontChangedHandler():void {
                    unloadCurrentFont();
                    LoadFontTextArea(String(availFonts.selectedItem));
                private function unloadCurrentFont():void {
                    if (_ta != null) {
                        panelToStuff.removeElement(_ta);
                        _ta = null;
                    panelToStuff.removeElement(sampleTextArea);
                    sampleTextArea = null;
                    sampleTextArea = new TextArea();
                    sampleTextArea.id = "sampleTextArea";
                    sampleTextArea.text = "Some text for your viewing pleasure. " + colorForBK.toString(16);
                    panelToStuff.addElement(sampleTextArea);               
                    if (_moduleInfo != null)
                        _moduleInfo.release();
                        //_moduleInfo.unload();
                        _moduleInfo = null;
                    System.gc();
                private function DoNonImportantWork():void {
                    colorForBK -= 0xFAA;
                    if (colorForBK < 0x0) colorForBK = 0xFFFFFF;
                    var foo:* = {prop1: "yea" + colorForBK.toString(), prop2:"boo" + colorForBK.toString()};
                    var hmm:String = foo.prop1 + " " + foo.prop2;
                    regedFonts = new ArrayCollection(Font.enumerateFonts(false));
                [Bindable]
                private var colorForBK:int = 0xFFFFFF;
                [Bindable]
                private var fonts:ArrayCollection =
                    new ArrayCollection(new Array("AlexandriaFLF.swf", "BPDiet.swf", "ChanpagneFont.swf", "KidsFont.swf"));
                [Bindable]
                private var regedFonts:ArrayCollection;
                [Bindable]
                private var fontNameForSample:String = "";
            ]]>
        </fx:Script>
        <s:VGroup id="panelToStuff">
            <s:HGroup>
                <s:Label id="status" text="status area" backgroundColor="{colorForBK}"/>
                <s:VGroup>
                    <s:DropDownList id="availFonts" dataProvider="{fonts}" change="fontChangedHandler()" />
                    <s:Button label="UnLoad" enabled="true" click="unloadCurrentFont()"/>
                    <s:Button label="doSome" enabled="true" click="DoNonImportantWork()"/>
                </s:VGroup>
            </s:HGroup>
            <s:HGroup>
                <s:Button click="fontNameForSample = 'BPDiet';" label="BPDiet"/>
                <s:Button click="fontNameForSample = 'Champagne';" label="Champagne"/>
                <s:Button click="fontNameForSample = 'Kids';" label="Kids"/>
            </s:HGroup>
            <s:Label text="{regedFonts.length} reg'ed"/>
            <s:TextArea id="sampleTextArea" fontFamily="{fontNameForSample}" text="Some Sample text for your viewing"/>
        </s:VGroup>
    </s:Application>
    A couple things to note; I am calling System.rc() in the unloadCurrentFont() method just to speed up seeing the SWF unload in the debug console. The DoNonImportantWork() is there to just cause some events to happen and to create some objects that will need to be GC'ed. It also let me know that the fonts are not getting registered in Font.
    I'm going to have 30 fonts (and more, that designer is busy) that I will need to be able to dynamically load, but right now, loading them with CSS style modules blows up after about 15 because style modules register the font so I cannot unload the CSS swf.

    To help eliminate the question of whether the TextArea is being held by something else, I have removed it from the MXML, and now programatically create it. That did not help.
    So, I got the trial version of Flash Builder 4 installed on another machine in the office so that I can use the profiler. (The profiler is pretty cool by the way).
    After a lot of profiing, I found four paths to the module's FlexModuleFactory.
    Two of those paths go to EmbeddedFontRegistry, whose data is static. I could get into it and remove font entry and free up the moduleFactory from there. This is a hack, that entry in/on EmbeddedFontRegistry.font should have been cleaned up by the code removing the fontFamily from the TextArea. (Note that EmbeddedFontRegistry is marked [ExcludeClass], which I assume means I should not really be messing with it.
    The other two I cannot get to as they are anonymous. They also don't appear to be referenced, as the Object References shows them both as GC root objects. Here is a screen shot:
    I did a search through the sdk code and 'fbs' only shows up as a parameter on the init function of various Marshal support classes, but is not used in the init()
    Anyway, these references to the FlexModuleFactory do not get held if I do not use the embeded font in the module.
    Here is the updated code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="400" minHeight="400">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.core.EmbeddedFont;
                import mx.core.EmbeddedFontRegistry;
                import mx.core.IEmbeddedFontRegistry;
                import mx.core.UIComponent;
                import mx.events.FlexEvent;
                import mx.events.ModuleEvent;
                import mx.managers.SystemManager;
                import mx.modules.IModule;
                import mx.modules.IModuleInfo;
                import mx.modules.Module;
                import mx.modules.ModuleManager;
                import spark.components.TextArea;
                private var _ta:TextArea = null;
                protected var _moduleInfo:IModuleInfo;
                private function LoadFontTextArea(fontSwf:String):void {
                    status.text = "Loading the font pack";
                    _moduleInfo = ModuleManager.getModule(fontSwf);
                    // add some listeners
                    _moduleInfo.addEventListener(ModuleEvent.READY, onModuleReady);
                    _moduleInfo.addEventListener(ModuleEvent.ERROR, moduleLoadErrorHandler);
                    _moduleInfo.addEventListener(ModuleEvent.UNLOAD, moduleUnloadHandler);
                    _moduleInfo.load();
                private function onModuleReady(event:ModuleEvent):void {
                    status.text = "The font pack swf Ready \n" + event.module.url;
                    //All I had todo was create the module, then I could access the embeded font by name
                    var fontMod:* = event.module.factory.create();
                    fontMod = null;
                private function moduleLoadErrorHandler(event:ModuleEvent):void {
                    status.text = "Font Module Load Error. \n" +
                        event.module.url + "\n"+ event.errorText;
                private function moduleUnloadHandler(event:ModuleEvent):void {
                    status.text = "Font Module Unload Event. \n" + event.module.url;
                private function fontChangedHandler():void {
                    unloadCurrentFont();
                    LoadFontTextArea(String(availFonts.selectedItem));
                private function unloadCurrentFont():void {
                    if (_ta != null && _moduleInfo != null) {
                        var fontName:String = _ta.getStyle("fontFamily");
                        _ta.setStyle("fontFamily", "");
                        _ta.validateProperties();
                        if (_ta.textDisplay) {
                            _ta.textDisplay.validateProperties();
                        panelToStuff.removeElement(_ta);               
                        _ta = null;
                        //This I should not have to do, but the framework is not doing it
                        var embFontReg:IEmbeddedFontRegistry = EmbeddedFontRegistry.getInstance();
                        var embFonts:Array = embFontReg.getFonts();
                        for each (var curEmbFont:EmbeddedFont in embFonts){
                            if (curEmbFont.fontName == fontName){
                                embFontReg.deregisterFont(curEmbFont, _moduleInfo.factory);
                    if (_moduleInfo != null)
                        _moduleInfo.unload();
                        _moduleInfo = null;
                    System.gc();
                private function AddTA():void {
                    _ta = new TextArea();
                    _ta.text = "Some text for your viewing pleasure. " + colorForBK.toString(16);
                    panelToStuff.addElement(_ta);
                private function DoNonImportantWork():void {
                    colorForBK -= 0xFAA;
                    if (colorForBK < 0x0) colorForBK = 0xFFFFFF;
                    var foo:* = {prop1: "yea" + colorForBK.toString(), prop2:"boo" + colorForBK.toString()};
                    var hmm:String = foo.prop1 + " " + foo.prop2;
                [Bindable]
                private var colorForBK:int = 0xFFFFFF;
                [Bindable]
                private var fonts:ArrayCollection =
                    new ArrayCollection(new Array("AlexandriaFLF.swf", "BPDiet.swf", "ChanpagneFont.swf", "KidsFont.swf"));
            ]]>
        </fx:Script>
        <s:VGroup id="panelToStuff">
            <s:HGroup>
                <s:Label id="status" text="status area" backgroundColor="{colorForBK}"/>
                <s:VGroup>
                    <s:DropDownList id="availFonts" dataProvider="{fonts}" change="fontChangedHandler()" />
                    <s:Button label="UnLoad" enabled="true" click="unloadCurrentFont()"/>
                    <s:Button label="AddTA" enabled="true" click="AddTA()"/>
                    <s:Button label="doSome" enabled="true" click="DoNonImportantWork()"/>
                </s:VGroup>
            </s:HGroup>
            <s:Button click="_ta.setStyle('fontFamily', 'BPDiet');" label="BPDiet"/>
        </s:VGroup>
    </s:Application>
    I really think I've reached the end of what I can do. This really seems like a bug.

Maybe you are looking for

  • How can I get my dropdown menus to work on Safari?

    I am in a real bind here. The blog I use for my class I teach has dropdown menus, but these don't seem to work in Safari on iPad. They work just fine in Chrome, but our lovely school blocks the Chrome browser...Don't even get me started. Is there som

  • Clearing the cache in an iWeb attempt to publish

    In creating a new site, I was publishing to a folder on my desktop. When I was ready, I attempted to publish to MobileMe. (I have an account.) I was unsuccessful and called AppleCare. They stepped me through clearing of the cache and then the publish

  • Trying to learn OPA.   Getting error.

    Hi, I am trying to learn OPA. I did the initial setup & tried testing 'AdminSmokeTest'rule base from Siebel. On clicking 'DS Smoke test' button from Policy Administration Smoke Test screen, I am getting successful result. However, on clicking "WS Smo

  • Soundbooth CS4 crashes consistently - can't use!

    I have a new copy of Creative Suite Web Premium CS4. I am trying to use Soundbooth to edit some small WAV files. It will open any file, display the waveform, and then crash. I cannot open ANY files at all! I let the updater look for updates, and appa

  • HT5527 Is there way to have a iCloud app that will work like the mobile me gallery short cut did?

    I really miss the MobileMe gallery app  I had on my iPhone.  does anyone out know of way that iCloud has something similar?