Hello all,

I thought I was finished with my embedded fonts project last night.
Tested it on Firefox, and it worked beautifully, so I shipped it to
the client.

As I have been testing it this morning, I have been getting an
intermittent error. It doesn't seem to be tied to the browser or Flash
Player version. When I try to register the first downloaded font. I'm
getting "Error 1508: The value specified for argument font is
invalid."

Summary of the project: in Flex, using code only, create a swf with
embedded fonts. Then download that swf, extract the fonts, and put
some text on screen with that font.

Relevant code from the embedded font swf:

public class EmbeddedFonts extends Sprite
{
        public function EmbeddedFonts()
        {
                Security.allowDomain("*");
        }

[Embed(
        source='../fonts/Garamond3/GaramThrBolItaOsF.ttf',
        fontName='Garam3BoldItalicEmbedded',
        embedAsCFF='false'
)]
public static var Garam3BoldItalicEmbedded: Class;

Relevant code from the downloader:

                private function loadSwf():void
                {
                        var urlRequest:URLRequest = new URLRequest(url);
                        loader = new Loader();
                        
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
handleLoadComplete);
                        loader.load(urlRequest);
                }
                
                private function handleLoadComplete(pEvent:Event):void
                {
                        var FontLibrary:Class;
                        
                        FontLibrary =
pEvent.target.applicationDomain.getDefinition("EmbeddedFonts") as
Class;
                        registerFonts(FontLibrary);
                        showText();                     
                }

                private function registerFonts(pFontLibrary:Class):void
                {
                        var fontLib:Class;
                        
                        fontLib = pFontLibrary;
                        Font.registerFont(fontLib.Garam3BoldItalicEmbedded); 
<-- Crashes
here with error 1508
                }

In the debugger, I see these values:

fontLib = EmbeddedFonts$(@b131f99)
Garam3BoldItalicEmbedded = EmbeddedFonts_Garam3BoldItalicEmbedded (@bc57e1)

Any idea what's going on? It was working last night, I swear! (Yes,
I've rebooted Windows :-)

Cordially,

Kerry Thompson
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to