Using embeded fonts in loaded swf.

I have a .Swf, which has 3 fonts embedded in it, they are all exported in frame 1 for AS.  This swf loads any number of external .swfs which have dynamically generated textfields inside of them.  This text must be embedded text because effects may be applied to them.  I do not want to embed the three fonts into every external swf, and do not think I should have to.  The font exists in the Loading swf and I have registered the fonts to the global font list.  If I print this list from the loaded swf, all three fonts are present, but when I try to use any of them, my textfiels are empty.
My question is how do I utilize a font which is embedded in a swf, from a swf which has been loaded into that swf?
From my external swf, this code:
[PHP]var embeddedFonts:Array = Font.enumerateFonts(false);
embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
trace(embeddedFonts);[/PHP]
produces the following:
[PHP][object CenturyBook],[object MyriadProRegular],[object MyriadProItalic][/PHP]
which are the three fonts that are embedded in the loading swf, So I assume the LOADED swf has access to these fonts.
When I apply this code to the externally loaded swf:
[PHP]var FontClass:Class = getDefinitionByName("MyriadProRegular") as Class;
trace("FontClassInstance -> " + FontClass.toString());
var linkedFont: Font = new FontClass();
trace("Font name: " + linkedFont.fontName);
var textFormat: TextFormat = new TextFormat(linkedFont.fontName, 14);
//... The next lines set up the text box and apply the format.  I am sure this is done correctly.
[/PHP]
I get the following output:
[PHP]FontClassInstance -> [class MyriadProRegular]
Font name: Myriad Pro[/PHP]
which is exactly what I would expect.  Yet, my text box is still blank.  I have embedText = true on the text box, and have applied a string to the "text" property, so it's nothing silly liek that.
Any help would be appreciated...

You may also want to look at the various embedded font format issues. Many of the Flex 4 components use a newer embedded font fortmat, which is not the same as the one generally used in Flash. So even if ther Flash font gets registered properly, it still may not work with some of the spark components.
You should be able to create a swf using Flex that contains fonts embedded in either format, which can then be used in the way you describe, though, since Flex 4 suports both font formats.
Hopefully, someone else will jump in here if I got some of this wrong.
-JM

Similar Messages

  • Using an Embedded Font in another .swf

    I am encountering a situation with font embedding that hopefully someone out there will know the solution to. This is a slightly boiled-down version of the problem but all the pertinent details are included. Without further ado, here's the situation:
    TLDR Version:  If I have a font embedded and registered with Font.registerFont(), and I attempt to use that font in a .swf that was compiled from an .fla in Flash CS5 that so much as MENTIONS that font, it fails.
    Longer Description:
    The Goal: Embed fonts in 1 .swf, use those fonts in many .swfs. Simple.
    Fonts.swf
    I have 3 .swf files. The first is called Fonts.swf. This was created in Flash CS5. It contains an embedded font( Franklin Gothic Demi ) with characters a-z, A-Z, numerals, and punctuation, etc. Regular, not bold. The font is exported for actionscript and the class is FranklinGothicDemi.
    On the main timeline of Fonts.swf is the code:
    Font.registerFont( FranklinGothicDemi ).
    Application.swf
    The second .swf is Application.swf. The following code snippet is from Application.as:
    [Embed(source="Fonts.swf")]
    private static var EmbeddedFonts:Class;
    initFonts()
    var embedFont:EmbeddedFonts = new EmbeddedFonts();
    embedFont.addEventListener( Event.COMPLETE, function( e:Event ){ traceEmbeddedFonts(); } );
    When traceEmbeddedFonts is called, it verifies that Franklin Gothic Demi is in fact registered.
    UserInterface.swf
    The third .swf file is UserInterface.swf. Fonts are NOT embedded in this file. They are not supposed to be. The project has many .swf files and they should all be using the fonts embedded in Fonts.swf.
    On the main timeline of UserInterface, it calls it's own version of traceEmbeddedFonts(), which again confirms that Franklin Gothic Demi is embedded.
    Inside UserInterface is a TextField we'll call mMainTextField, with some text, say "Main Menu". The font is "Franklin Gothic Demi", the anti-alias style is 'use device fonts.' I have tried other anti-alias styles as well.
    As it turns out, UserInterface.swf is 'embedding' Franklin Gothic Demi, with a character set of a big fat 0 characters. This is taking precedence over the Franklin Gothic Demi font embedded from Fonts.swf. I can side-step this problem by setting mMainTextField to use some other Font while publishing and then using actionscript to change it back to Franklin Gothic Demi when the project is running, but that's not a solution that is friendly to the artists.
    In essence, the question is simple: Why is Flash Embedding and Registering fonts with character sets of size 0, despite the fact that nowhere in UserInterface.swf is there a request to embed fonts, and how do I prevent it from doing so?
    If anyone who sees this has already encountered and solved this problem and shares the solution with me, you will be my favorite person .
    Thanks!
    -J

    You know, I think its just a bug inside Flash Builder Burrito. When I run my app through the emulator it doesn't display correctly but when I run it on my phone it works as it should.

  • AIR 3.0 mx:HTML embedded fonts in external swf - silent craziness

    The recent upgrade to AIR 3.0 has hosed our application.  We rely heavily on an mx:HTML control to render the UI of our application using javascript and HTML templates.  Everything has been working great in production for months, until Adobe released AIR 3.0 last week.  We use embedded fonts in our application that our defined in an external .swf (loaded at runtime).  The HTML control loads a .css file that references the name of our embedded font "ArialEmbedded" and it all worked great.  But now, with 3.0 it does not respect anything in the external .swf.  We get the default Times New Roman font in all of our content, and the app crashes with reliability (in debug mode and release mode) without any exceptions being thrown.
    Using the Windows Debugger, I have been able to track it down to this call consistently - Webkit!cairo_pattern_get_type with an Access Violation erros - c0000005 . 
    After some Googling, it seems webkit uses Cairo for the graphics rendering portion of the library, and in this case it is trying to render a specific color.
    1) I've tried forcing the moduleLoader on the HTML control to use the moduleLoader of the parent Spark component - to no avail.
    2) Did something change with style management and loading external .swf files?
    3) Any other help?  At this point, I have no idea where to begin.  When it crashes, usually during the rendering of items in a grid the AIR process will grab about 2GB of RAM all at once and then stop working with the windows process stopped working dialog.
    Thanks for any help,
    Steve

    Hi,
    Could you please open a new bug report on this over at bugbase.adobe.com? Please include sample media, code, project or app to help us reproduce the issue. Finally, once the bug has been added, would you mind posting back with the URL so that others affected can add their votes and comments?
    Thanks,
    Jian
    Adobe Flash Runtime team

  • Using embedded fonts

    Hi,
    I've embedded font into an SWF in the following manner:
    package resources.fonts
    import flash.display.Sprite;
    public class _Arial extends Sprite
    [Embed(source='c:/windows/fonts/Arial.ttf',
    fontName='_Arial')]
    public static var _Arial:Class;
    Now when I try to load it in my AIR app, I get "IFlexAsset
    could not be found" error when the file gets loaded. Any
    ideas?

    @Flex, thanks. I have tried, and succeeded in making swf containers for fonts in various ways including using the fontswf app but they never seem to be used after I have loaded them in the main application. I have asked a couple of questions here:
    http://stackoverflow.com/questions/12846752/embedded-font-flash-text-engine There doesn't seem to be any error message, the font just 'silently' isn't used. Do you think that it just isn't possible? The documentation I've been able to dig up all seems to indicate that it should be; including the sentence I quote above.

  • [svn:fx-trunk] 10545: Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts

    Revision: 10545
    Author:   [email protected]
    Date:     2009-09-23 13:33:21 -0700 (Wed, 23 Sep 2009)
    Log Message:
    Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts
    QE Notes: 2 Mustella tests fail:
    components/DataGrid/DataGrid_HaloSkin/Properties/datagrid_properties_columns_halo datagrid_properties_columns_increase0to1_halo
    components/DataGrid/DataGrid_SparkSkin/Properties/datagrid_properties_columns datagrid_properties_columns_increase0to1
    These fixes get us to measure the embedded fonts correctly when going from 0 columns to a set of columns so rowHeight will be different (and better) in those scenarios
    Doc Notes: None
    Bugs: SDK-15241
    Reviewer: Darrell
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/browser/DataGrid
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-15241
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridBase .as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridColu mn.as

    Hi Matthias,
    Sorry, if this reply seems like a products plug (which it is), but this is really how we solve this software engineering challenge at JKI...
    At JKI, we create VI Packages (which are basically installers for LabVIEW instrument drivers and toolkits) of our reusable code (using the package building capabilities of VIPM Professional).  We keep a VI Package Configuration file (that includes a copy of the actual packages) in each of our project folders (and check it into source code control just as we do for all our project files).  We also use VIPM Enterprise to distribute new VI Packages over the network.
    Also, as others have mentioned, we use the JKI TortoiseSVN Tool to make it easy to use TortoiseSVN directly from LabVIEW.
    Please feel free to contact JKI if you have any specific questions about these products.
    Thanks,
    -Jim 

  • How to use embedded font

    Hi all,
    I have a flex application where i want to rotate the textarea.I have a mxml file and a .as file.I want to use the embedded font in my application.But I don't know anything.Please advice me details and also how to proceed to create embedded font,how to create the ttf file?I am not using any package and not using library path.
    Please help me.Thanks in advance.

    FangAvatar,
    looks like the same question as the other one we are talking about. The Live docs page
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=fonts_04.html
    has ane xample with rotated labels just oevr half way down the page.
    If you are having trouble navigating with this link, just go to the root
    http://www.adobe.com/livedocs/flex/3/html/help.html
    then in the contents bar on the left open up
    User interfaces
    ...using fonts
    ......using embedded fonts
    the section is just above the heading "Using advanced anti-aliasing"
    Richard

  • Embeded fonts to load when i wont not in the beginning

    How do i make that the embeded fonts load whenever i want?
    they just take
    ages to load in a slow connection and until they are not
    loaded the movie
    doesnt start, and how do i make a loading in this case???
    anyone can help?

    When using this method, consider the Flash Player security
    model:
    For Flash Player 8:
    Data loading is not allowed if the calling SWF file is in the
    local-with-file-system sandbox and the target resource is from a
    network sandbox.
    Data loading is also not allowed if the calling SWF file is
    from a network sandbox and the target resource is local.
    For more information, see the following:
    Chapter 17, "Understanding Security," in Learning
    ActionScript 2.0 in Flash
    The Flash Player 8 Security white paper at
    http://www.macromedia.com/go/fp8_security
    The Flash Player 8 Security-Related API white paper at
    http://www.macromedia.com/go/fp8_security_apis
    For Flash Player 7 and later:
    Websites can permit cross-domain access to a resource via a
    cross-domain policy file.
    In SWF files of any version running in Flash Player 7 and
    later, url must be in exactly the same domain. For example, a SWF
    file at www.someDomain.com can load data only from sources that are
    also at www.someDomain.com

  • (How) can I use Embeded Fonts in Flex 3.3

    If I understand correctly, I need to transcode/embed the fonts in Flex 4 / CS 4, but is there any way to then get those embeded fonts into a Flex 3.3 application?

    Support for DefineFont4 (the cff property) is new in Flex Gumbo. It is not available in Flex 3.X. That said – I do have a solution for you. Create a separate Flex Gumbo project and use the cff property to embed the font you need into that SWF. Then embed the font SWF that you just created in Gumbo into your Flex 3.3 application.
    Check out the “Building a Font SWF for use in any Flash Application” section in my DefineFont4 blog post:
    http://blogs.adobe.com/tlf/2008/11/embedded_font_subsetting_using.html
    Here is an article on embedding a SWF in Flex:
    http://blog.flexexamples.com/2007/10/25/embedding-fonts-from-a-flash-swf-file-into-a-flex- application/
    Hope this helps!

  • Possible to use embedded font in TLFTextField, with TextFormat?

    I want to be able to dynamically change the font in a TLFTextField to an embedded font (not a device font).  I'm using Flash CS5.
    The only way I've found a TLFTextField will use an embedded font is if the on-stage TLFTextField has been set to use that font through the Flash UI.  The example code I've found online (Font.registerFont etc) all works fine for a TextField, but not TLFTextField.
    Below is a very simple piece of code that I expected to work.  I have a font (Earwig Factory) embedded in my library (as DF4, linkage "Earwig"), and the isFontCompatible trace call prints "true", but still it is using the device font - if I remove the system font from my machine (or view the SWF on another machine) it falls back to Times New Roman.
    Can anyone give a very simple example of a TLFTextField dynamically selecting an embedded font?  Eventually I would like to store my fonts in a separate SWC / SWF, but for now just working out of the Library would be a good start.
    Thanks,
    Grant
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.FontStyle;
    import fl.text.TLFTextField;
    import flash.text.engine.FontLookup;
    var format:TextFormat = new TextFormat();
    format.font = "Earwig Factory"
    trace("Earwig Factory isFontCompatible: " + tf.isFontCompatible("Earwig Factory", FontStyle.REGULAR) );
    tf.defaultTextFormat = format;
    tf.embedFonts = true;
    //tf.antiAliasType = AntiAliasType.ADVANCED;
    tf.setTextFormat(format);
    //tf.textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

    Ok, I have some success - I can get an on-stage TLFTextField to dynamically use an embedded font.  However, this is quite complex, and doesn't use a TextFormat.  And is this seriously the way Adobe intends us to do it - if so perhaps this should be documented better?
    import fl.text.TLFTextField;
    import flashx.textLayout.formats.TextLayoutFormat;
    import flashx.textLayout.elements.TextFlow;
    import flash.text.TextFormat;
    import flash.text.AntiAliasType;
    import flash.text.FontStyle;
    import flash.text.Font;
    import flash.text.engine.FontLookup;
    import flashx.textLayout.edit.ISelectionManager;
    import flashx.textLayout.edit.EditManager;
    import flashx.textLayout.edit.SelectionState;
    var updateTF:TLFTextField = stageTF;
    var applyFont:Font = new Earwig();
    updateTF.embedFonts = true;
    var tlfFormat:TextLayoutFormat = new TextLayoutFormat();
    tlfFormat.fontFamily = applyFont.fontName;
    tlfFormat.fontLookup = FontLookup.EMBEDDED_CFF;
    updateTF.textFlow.invalidateAllFormats();
    updateTF.textFlow.hostFormat = tlfFormat;
    var prevManager:ISelectionManager = updateTF.textFlow.interactionManager;
    var editManager:EditManager = new EditManager();
    var sel:SelectionState = new SelectionState(updateTF.textFlow, 0, updateTF.text.length);
    updateTF.textFlow.interactionManager = editManager;
    editManager.applyLeafFormat(tlfFormat, sel);
    updateTF.textFlow.interactionManager = prevManager;
    updateTF.textFlow.flowComposer.updateAllControllers();

  • 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

  • Trouble with Preview not using embedded fonts in a PDF

    I have a client I'm working with that is generating PDF reports for various organizations in various languages. They are using an Arial Unicode font but are using different encoding for some of the more unique languages. To ensure the report will be viewable regardless of installed fonts, they are embedding the font.
    Most of the languages are showing up fine in preview, but three languages are giving me trouble. Specifically Greek, Russian and Thai which are using encoding EL8MSWIN1253, CP1251, and TH8TISASCII.
    Basically the question is whether there is some toggle that will tell Preview to use the embedded font? Or something we can put into the PDF (the pdf is created using FPDF) that will allow a user to know which font/encoding they'll need to install in order to properly view the document? (I'm actually trying to figure that out myself...which font I need to install to get preview to view the document properly).
    Thanks in advance for any help.

    Actually, I got that example to work... here are the changes
    I made...
    <mx:htmlText>
    <![CDATA[You can vary the <font size='20'>font
    size</font>,<br><font
    color="#0000FF">color</font>,<br><font
    face="Courier New">face</font>, or<br><font
    size="18"color="#FF00FF"face="Times New Roman">any combination
    of the three.</font>]]>
    </mx:htmlText>
    As I said above, I have found errors in the code of the help
    docs... this is yet another one of them. Usually its spaces in the
    wrong place, or no space at all, or missing ) or ], or a case
    sensitivity issue.
    If you got your custom font to display, that should work...
    but then again.. what should work, doesn't always.

  • Since moving to a new MAC Firefox asks permsion to use various font whilst loading - how can I stop this?

    I moved over to a new Apple Mac using a time machine back up. Since then when ever I use Firefox it stops and asks if it's ok to use a font located on an external hardrive. How can I stop this?

    I tried reloading FF but had the same problem but maybe I need to completely eradicate any trace of FF first - is there a way of doing this.
    I've already moved back to Safari but there are a couple of sites I have to use that don't work properly so I have to revert to FF

  • Using jump menu to load swf to a target...

    is it possible to use the selections of a jump menu, once when one is selected to load a .swf to a certain target on the page.
    i.e. at www.meadowlarkco.com/index2_new8.htm I have a jump menu with selections within it. Is it possible for instance once I select "flatbed services" for it to a load a new .swf movie to a location on the page, much like an empty mc holder would be used. Then when each new selection is made from the jump menu it will load the according .swf to the same location.....how would I start this script to change my current jump menu?
    thanks for any help provided

    For many reasons, a JumpMenu would not be my first choice for this.  You need a stable cross browser media player embedded into the page and a playlist of files to pull this off.
    Have a look at Wimpy Rave with Full Advertising / Playlists (NOTICE: this link contains auto playing sound and video).
    http://www.wimpyplayer.com/examples/rave/ex_ad_playlist.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • AS3: embeded audio in loaded SWF

    i'm trying to update an AS2 swf/audio player to AS3 and
    running into trouble. i'm exporting an embedded mp3 as a Sound
    object, then loading that SWF into a player engine that is
    skinnable... is there anyway to treat the SWF as a streaming sound?
    Having to wait until the Loader INIT event fires isn't really gonna
    work...
    i had attempted encoding the audio as FLV, which was working
    great with FLVPlayback - until you do anything to the browser
    window (like resizing) which causes erratic sound playback. not
    cool...
    thanks!!!!!

    to stop all movieclips use:
    var imageReq:URLRequest = new URLRequest("square.swf");
    var imageLoader:Loader = new Loader();
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
    imageLoader.load(imageReq);
    function loadHandler (event:Event)
        var myClip:MovieClip = event.currentTarget.loader.content
        addChild(myClip);
        stopAllF(myClip);
    function stopAllF(mc:MovieClip):void{
    mc.stop();
    for(var i:int=0;i<mc.numChildren;i++){
    if(mc.getChildAt(i) is MovieClip){
    MovieClip(mc.getChildAt(i));

  • How to use symbols in a loaded swf

    I want to load a swf file in flex as application with embed
    tag and then create instance of its class. I want to use symbols
    within this swf i.e. to load dynamically those symbols when needed
    and play with it. is it possible in flex builder 3? If yes then how
    and if not then how can it be done? Any suggestion is
    appriciated.

    Hello,
    using that page as guide:
    http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/Uncau ghtErrorEvent.html#includeExamplesSummary
    (last sample on where to insert handlers) what about:
    <s:SWFLoader id="swfLoader" init="swfLoaderInitHandler(event)" source="B.swf"/>
    and:
    protected function swfLoaderInitHandler(event:Event):void
         if(!swfLoader.content) return;
         swfLoader.content.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAU GHT_ERROR,
              uncaughtErrorHandler);
    protected function uncaughtErrorHandler(errorEvent:UncaughtErrorEvent):void
         if(errorEvent.error is Error)
              var e:Error = errorEvent.error as Error;
              // my error is 1009 - it is expected here
              const NULL_ERROR:uint = 1009;
              if(e.errorID == NULL_ERROR)
                   errorEvent.preventDefault();
                   Alert.show(e.errorID+" "+e.message);
              // else fall through
         // else fall through
    B is supposed to fail:
    private var emptyObject:Object = null;
    public function B()
         flash.utils.setTimeout(throwErrorNow, 100);
    protected function throwErrorNow():void
         emptyObject.numericValue();
    regards,
    Peter

Maybe you are looking for