[Flashcoders] Embedded fonts Bug

2010-09-24 Thread Kerry Thompson
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


RE: [Flashcoders] Embedded fonts Bug

2010-09-24 Thread Keith Reinfeld
Kerry, 

I suggest that you try doing the Font.registerFont(Garam3BoldItalicEmbedded)
in your 'embedded font swf'. Load the swf into your 'downloader' then simply
use it in your showText(). 

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net


 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Kerry Thompson
 Sent: Friday, September 24, 2010 2:22 PM
 To: Flash Coders List
 Subject: [Flashcoders] Embedded fonts Bug
 
 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

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Embedded fonts Bug

2010-09-24 Thread Kerry Thompson
Keith Reinfeld wrote:

 I suggest that you try doing the Font.registerFont(Garam3BoldItalicEmbedded)
 in your 'embedded font swf'. Load the swf into your 'downloader' then simply
 use it in your showText().

Thanks, Keith. That's actually one of the many things I have tried,
and I end up with empty text boxes.

I've also tried making the registerFont() method in my EmbeddedFonts
class available by declaring it public static, but I don't see it when
I look at the swf in the debugger. I see all the fonts, which are also
public static var, but not the method. The variable that holds the
downloaded swf is declared type Class.

Cordially,

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


RE: [Flashcoders] Embedded fonts Bug

2010-09-24 Thread Keith Reinfeld
Have you specified a fontWeight and a fontStyle? 

[Embed(
source='../fonts/Garamond3/GaramThrBolItaOsF.ttf',
fontName='Garam3BoldItalicEmbedded',
fontWeight='bold',
fontStyle = 'italic',
embedAsCFF='false'
)]

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net


 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Kerry Thompson
 Sent: Friday, September 24, 2010 4:03 PM
 To: Flash Coders List
 Subject: Re: [Flashcoders] Embedded fonts Bug
 
 Keith Reinfeld wrote:
 
  I suggest that you try doing the
 Font.registerFont(Garam3BoldItalicEmbedded)
  in your 'embedded font swf'. Load the swf into your 'downloader' then
 simply
  use it in your showText().
 
 Thanks, Keith. That's actually one of the many things I have tried,
 and I end up with empty text boxes.
 
 I've also tried making the registerFont() method in my EmbeddedFonts
 class available by declaring it public static, but I don't see it when
 I look at the swf in the debugger. I see all the fonts, which are also
 public static var, but not the method. The variable that holds the
 downloaded swf is declared type Class.
 
 Cordially,
 
 Kerry Thompson
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Embedded fonts Bug

2010-09-24 Thread Kerry Thompson
Keith Reinfeld wrote:

 Have you specified a fontWeight and a fontStyle?

 [Embed(
        source='../fonts/Garamond3/GaramThrBolItaOsF.ttf',
        fontName='Garam3BoldItalicEmbedded',
        fontWeight='bold',
        fontStyle = 'italic',
        embedAsCFF='false'
 )]

Yes, I have, and it didn't seem to make a difference.

I'm wondering, though, if I'm getting these new asset swfs. IE and
Firefox both cache swfs, especially RSL's. I'm not building the asset
swf as an RSL, but I've started clearing the cache manually for every
test. It makes me wonder if some of the tests I've run were valid.

Cordially,

Kerry Thompson

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders