Re: [flexcoders] Embedding fonts at runtime

2006-08-31 Thread Daniel Wabyick
Hi Daniel,

I am a little confused what you mean exactly. I have tried to set a 
Label mxml component's style directly using the fontFamily name, and 
when I do the text in the label diappears. Did you get it to actually 
display the symbol font?

Here is the pertinent part of my current code:

 mx:Label id=myLabel text=test /
mx:Script
 ![CDATA[

 private var ldr:Loader;
 private function onInit() : void
 {
 showFonts();

 var context:LoaderContext = new LoaderContext();
 context.applicationDomain = 
ApplicationDomain.currentDomain;
 var req:URLRequest = new URLRequest( SymbolInclude.swf );

 ldr = new Loader();
 ldr.contentLoaderInfo.addEventListener( Event.COMPLETE, 
onLoaderComplete );
 ldr.load( new URLRequest( SymbolInclude.swf), context );
 }

 private function onLoaderComplete(e:Event) : void
 {
 trace(onLoaderComplete: );

var content:DisplayObject = ldr.content;
var c:Class = content[myFont];
Font.registerFont(c);
  
   myLabel.setStyle( fontFamily, mySymbol );
 showFonts();
 }


 public function showFonts():void
 {
   trace(showFonts());
  var fontList : Array = Font.enumerateFonts();
for ( var i:String in fontList )
{
trace(font:  + Font( fontList[i] ).fontName);
}
   }
 ]]
 /mx:Script




Daniel Freiman wrote:

 I figured out how to use the textformat object.  The textformat object 
 does actually work, but a TextField will only retrieve the embeded 
 font if it's parent has previously been sent set the font as a style.  
 So for any component that uses a UITextField, set the fontFamily style 
 of the parent UIComponent to the newly loaded font and then the 
 UITextField should be able to use the font even if fontFamily is 
 subsequently reset.  I have no idea why this works, so there may be 
 some improvements to this method.

 On 8/30/06, *Brian Deitte* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 One addition to this, which is that we always include the space
 character when you specify the unicode range.  I'm not sure the
 original reasoning for this, but I just noticed it in the code. 
 Also, you can specify multiple ranges, separated by commas.  -Brian

 
 
 *From:* flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com
 [mailto:flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com] *On Behalf Of *Dirk Eismann
 *Sent:* Wednesday, August 30, 2006 2:07 PM
 *To:* flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] Embedding fonts at runtime

 Yes, this is possible:
  
 [Embed(source=Arial.ttf, fontName=myArial,
 unicodeRange=U+0041-U+005A )]
 public var myClass:Class;
  
 Dirk.
  
 
 *Von:* flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com im Auftrag von Daniel Wabyick
 *Gesendet:* Mi 30.08.2006 18:58
 *An:* flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com
 *Betreff:* Re: [flexcoders] Embedding fonts at runtime

 Awesome! I'll definitely have to check this out.

 On a related note, I wonder if its possible to embed fonts with a
 specific unicode range via this syntax.  It doesn't appear to be.

 [Embed(systemFont='Symbol', fontName='mySymbol',
 mimeType='application/x-font')]
 var myFont:Class;

 I know you can use @font-face, which appears to automatically
 generate a
 variable in the class, but its not a consistently named variable. I am
 sure a utility function in the class could be used to ferret out that
 variable name.


 Daniel Freiman wrote:
 
  I altered the code a little and got it half working.  It works if
  you're setting the imported font using setStyle, but not if you're
  setting the font through the TextFormat object.  Simply add the
 lines:
 
  var content:DisplayObject = ldr.content;
  var c:Class = content[myFont];
  Font.registerFont(c);
 
  to the begining of onloadercomplete.
 
  I'm going to continue working on how to get the font to show up
  through TextFormat.
 
 
  On 8/29/06, * Daniel Wabyick* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
   mailto:[EMAIL

Re: [flexcoders] Embedding fonts at runtime

2006-08-31 Thread Daniel Freiman



I've been working with a font I don't have installed on my computer, so I could be sure it was working, although I also tried it with system fonts and it has worked. The only thing I can think of is that I set the fontName to the same value as the actual font name. If that doesn't work I can send you my code.
On 8/31/06, Daniel Wabyick [EMAIL PROTECTED] wrote:
Hi Daniel,I am a little confused what you mean exactly. I have tried to set aLabel mxml component's style directly using the fontFamily name, andwhen I do the text in the label diappears. Did you get it to actually
display the symbol font?Here is the pertinent part of my current code: mx:Label id=myLabel text=test /mx:Script ![CDATA[ private var ldr:Loader;
 private function onInit() : void { showFonts(); var context:LoaderContext = new LoaderContext(); context.applicationDomain =
ApplicationDomain.currentDomain; var req:URLRequest = new URLRequest( SymbolInclude.swf ); ldr = new Loader(); ldr.contentLoaderInfo.addEventListener
( Event.COMPLETE,onLoaderComplete ); ldr.load( new URLRequest( SymbolInclude.swf), context ); } private function onLoaderComplete(e:Event) : void
 { trace(onLoaderComplete: );var content:DisplayObject = ldr.content;var c:Class = content[myFont];Font.registerFont
(c); myLabel.setStyle( fontFamily, mySymbol ); showFonts(); } public function showFonts():void {
 trace(showFonts());var fontList : Array = Font.enumerateFonts();for ( var i:String in fontList ){trace(font:  + Font( fontList[i] ).fontName);
} } ]] /mx:ScriptDaniel Freiman wrote: I figured out how to use the textformat object.The textformat object
 does actually work, but a TextField will only retrieve the embeded font if it's parent has previously been sent set the font as a style. So for any component that uses a UITextField, set the fontFamily style
 of the parent UIComponent to the newly loaded font and then the UITextField should be able to use the font even if fontFamily is subsequently reset.I have no idea why this works, so there may be
 some improvements to this method. On 8/30/06, *Brian Deitte* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 wrote: One addition to this, which is that we always include the space character when you specify the unicode range.I'm not sure the original reasoning for this, but I just noticed it in the code.
 Also, you can specify multiple ranges, separated by commas.-Brian  *From:* 
flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com] *On Behalf Of *Dirk Eismann *Sent:* Wednesday, August 30, 2006 2:07 PM *To:* 
flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] Embedding fonts at runtime
 Yes, this is possible: [Embed(source=Arial.ttf, fontName=myArial, unicodeRange=U+0041-U+005A )] public var myClass:Class;
 Dirk.  *Von:* flexcoders@yahoogroups.com mailto:
flexcoders@yahoogroups.com im Auftrag von Daniel Wabyick *Gesendet:* Mi 30.08.2006 18:58 *An:* flexcoders@yahoogroups.com
 mailto:flexcoders@yahoogroups.com *Betreff:* Re: [flexcoders] Embedding fonts at runtime Awesome! I'll definitely have to check this out.
 On a related note, I wonder if its possible to embed fonts with a specific unicode range via this syntax.It doesn't appear to be. [Embed(systemFont='Symbol', fontName='mySymbol',
 mimeType='application/x-font')] var myFont:Class; I know you can use @font-face, which appears to automatically generate a variable in the class, but its not a consistently named variable. I am
 sure a utility function in the class could be used to ferret out that variable name. Daniel Freiman wrote:   I altered the code a little and got it half working.It works if
  you're setting the imported font using setStyle, but not if you're  setting the font through the TextFormat object.Simply add the lines:   var content:DisplayObject = 
ldr.content;  var c:Class = content[myFont];  Font.registerFont(c);   to the begining of onloadercomplete. 
  I'm going to continue working on how to get the font to show up  through TextFormat.On 8/29/06, * Daniel Wabyick* 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]   mailto:[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote:   I just tried to dynamically load a font at runtime, and the  results are  not too promising. 
  For other's benefits, here is what I did:   - Created an AS3 project and generated a SWF (SymbolEmbed.swf)  with the  Symbol font embedded.
   - Verified the font is available in the SWF via Font.enumerateFonts();   - Loaded SymbolEmbed.swf into a Flex app using the Loader class,
  following instructions to keep the SWF's on the same  applicationDomain.   - Checked if the font is available to the Flex app, it is not. 
  Please let me know if anyone has any ideas,   -Daniel  Code: AS3 project with embedded font

RE: [flexcoders] Embedding fonts at runtime

2006-08-31 Thread Roger Gonzalez





It is however possible to [Embed] font(s) into an AS class used to build 
a SWF, and then dynamically load that SWF.

-rg

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Matt 
  HornSent: Wednesday, August 30, 2006 1:23 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Embedding fonts 
  at runtime
  
  
  [Embed] is always at compile time, so I dont think this solution 
  matchesyour requirements of loading teh fonts at run time.-m 
   -Original Message- From: [EMAIL PROTECTED]ups.com 
   [mailto:[EMAIL PROTECTED]ups.com] 
  On Behalf Of Tom Lee Sent: Wednesday, August 30, 2006 4:01 PM 
  To: [EMAIL PROTECTED]ups.com 
  Subject: RE: [flexcoders] Embedding fonts at runtime  Just 
  wondering, is [Embed] directive compile-time, or run-time?  
 
   From: [EMAIL PROTECTED]ups.com 
   [mailto:[EMAIL PROTECTED]ups.com] 
  On Behalf Of Brian Deitte Sent: Wednesday, August 30, 2006 2:43 
  PM To: [EMAIL PROTECTED]ups.com 
  Subject: RE: [flexcoders] Embedding fonts at runtime   
   One addition to this, which is that we always include the  
  space character when you specify the unicode range. I'm not  sure the 
  original reasoning for this, but I just noticed it  in the code. Also, 
  you can specify multiple ranges,  separated by commas. -Brian 
  
     
  From: [EMAIL PROTECTED]ups.com 
   [mailto:[EMAIL PROTECTED]ups.com] 
  On Behalf Of Dirk Eismann Sent: Wednesday, August 30, 2006 2:07 
  PM To: [EMAIL PROTECTED]ups.com 
  Subject: RE: [flexcoders] Embedding fonts at runtime  Yes, 
  this is possible:
  [Embed(source="Arial.ttf", fontName="myArial",  
  unicodeRange="U+0041-U+005A" )]  public var 
  myClass:Class;Dirk.  
 
     Von: 
  [EMAIL PROTECTED]ups.com 
  im Auftrag von Daniel Wabyick Gesendet: Mi 30.08.2006 18:58 
  An: [EMAIL PROTECTED]ups.com 
  Betreff: Re: [flexcoders] Embedding fonts at runtime  Awesome! 
  I'll definitely have to check this out.  On a related note, I 
  wonder if its possible to embed  fonts with a specific unicode 
  range via this syntax. It doesn't  appear to be.  
  [Embed(systemFont='Symbol', fontName='mySymbol', 
  mimeType='application/x-font')] var myFont:Class; 
   I know you can use @font-face, which appears to  
  automatically generate a variable in the class, but its not a 
  consistently named  variable. I am sure a utility function in 
  the class could be used to  ferret out that variable 
  name.   Daniel Freiman wrote:  
   I altered the code a little and got it half working.  It works 
  if  you're setting the imported font using setStyle, but  
  not if you're  setting the font through the TextFormat object. 
   Simply add the lines:   var 
  content:DisplayObject = ldr.content;  var c:Class = 
  content["myFont"];  Font.registerFont(c); 
to the begining of onloadercomplete.  
   I'm going to continue working on how to get the font  to show 
  up  through TextFormat.On 
  8/29/06, * Daniel Wabyick* [EMAIL PROTECTED]com  
  mailto:[EMAIL PROTECTED]com 
   mailto:[EMAIL PROTECTED]com  
  wrote:   I just tried to dynamically load a font at 
   runtime, and the  results are  not too 
  promising.   For other's benefits, here is what I 
  did:   - Created an AS3 project and generated a SWF 
   (SymbolEmbed.swf)  with the  Symbol font 
  embedded.   - Verified the font is available in the 
  SWF via  Font.enumerateFonts();   - 
  Loaded SymbolEmbed.swf into a Flex app using  the Loader 
  class,  following instructions to keep the SWF's on the 
  same  applicationDomain.   - Checked if 
  the font is available to the Flex  app, it is not. 
Please let me know if anyone has any ideas, 
-Daniel
Code: AS3 project with embedded font.  
  ---  public class SymbolInclude extends 
  Sprite  {  public function 
  SymbolInclude()  {  
  [Embed(systemFont='Symbol',  fontName='mySymbol', 
   mimeType='application/x-font')]  var 
  myFont:Class;   trace("here in 
  SymbolInclude");  var fontList : Array = 
  Font.enumerateFonts();  for ( var i:String in fontList 
  )  {  trace("font: " + Font(  fontList[i] 
  ).fontName);  }  }  }  
Code: Loader code in Flex app.  
  --- 
mx:Script  ![CDATA[ 
private var ldr:Loader;  private function 
  onInit() : void  {  showFonts();  
   var context:LoaderContext = new  
  LoaderContext();  //context.securityDomain = 
   SecurityDomain.currentDomain;  
  context.applicationDomain =  
  ApplicationDomain.currentDomain;   ldr = new 
  Loader();  
  ldr.contentLoaderInfo.addEventListener(  
  Event.COMPLETE,  onLoaderComplete );  ldr.load( new 
  URLRequest(  "SymbolInclude.swf"),  context 
  );  }   private function  
  onLoaderComplete(e:Event) : void  {  
  trace("onLoaderComplete: ");  showFo

Re: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Daniel Freiman



I altered the code a little and got it half working. It works if you're setting the imported font using setStyle, but not if you're setting the font through the TextFormat object. Simply add the lines: var content:DisplayObject = 
ldr.content; var c:Class = content[myFont]; Font.registerFont(c);to the begining of onloadercomplete.I'm going to continue working on how to get the font to show up through TextFormat.
On 8/29/06, 
Daniel Wabyick [EMAIL PROTECTED] wrote:

I just tried to dynamically load a font at runtime, and the results arenot too promising.For other's benefits, here is what I did:- Created an AS3 project and generated a SWF (SymbolEmbed.swf) with the
Symbol font embedded.- Verified the font is available in the SWF via Font.enumerateFonts();- Loaded SymbolEmbed.swf into a Flex app using the Loader class,following instructions to keep the SWF's on the same applicationDomain.
- Checked if the font is available to the Flex app, it is not.Please let me know if anyone has any ideas,-DanielCode: AS3 project with embedded font.---
public class SymbolInclude extends Sprite
{public function SymbolInclude(){[Embed(systemFont='Symbol', fontName='mySymbol',mimeType='application/x-font')]var myFont:Class;trace(here in SymbolInclude);
var fontList : Array = Font.enumerateFonts();for ( var i:String in fontList ){trace(font:  + Font( fontList[i] ).fontName);}

}}Code: Loader code in Flex app.---mx:Script ![CDATA[ private var ldr:Loader; private function onInit() : void
 { showFonts(); var context:LoaderContext = new LoaderContext(); //context.securityDomain = SecurityDomain.currentDomain; 
context.applicationDomain =ApplicationDomain.currentDomain; ldr = new Loader(); ldr.contentLoaderInfo.addEventListener( Event.COMPLETE,onLoaderComplete ); 
ldr.load( new URLRequest( SymbolInclude.swf), context ); } private function onLoaderComplete(e:Event) : void { trace(onLoaderComplete: );
 showFonts(); } public function showFonts():void { trace(showFonts());var fontList : Array = Font.enumerateFonts

();for ( var i:String in fontList ){trace(font:  + Font( fontList[i] ).fontName);} }

 ]] /mx:ScriptDaniel Freiman wrote: I have this question too but it hasn't reached the top of my to-do list yet.What I'm hoping is that is that you can embed a font in a
 swf and then load that swf at runtime using a swfloader. On 8/28/06, *Daniel Wabyick* 
[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hey guys, Is there any way to include a font at runtime using Flex 2?There was a weird hack that works in Flash 8 where you load a movie that loads an
 RSL. Does anything like this work in Flex 2 ? Thanks, -Daniel -- Flexcoders Mailing List FAQ: 

http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
 
http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links 
http://groups.yahoo.com/group/flexcoders/
 mailto:[EMAIL PROTECTED] 
http://docs.yahoo.com/info/terms/
--Flexcoders Mailing ListFAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/* To unsubscribe from this group, send an email to:

[EMAIL PROTECTED]* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Dirk Eismann
Yes, this is possible:
 
[Embed(source=Arial.ttf, fontName=myArial, unicodeRange=U+0041-U+005A )]
public var myClass:Class;
 
Dirk.
 



Von: flexcoders@yahoogroups.com im Auftrag von Daniel Wabyick
Gesendet: Mi 30.08.2006 18:58
An: flexcoders@yahoogroups.com
Betreff: Re: [flexcoders] Embedding fonts at runtime



Awesome! I'll definitely have to check this out.

On a related note, I wonder if its possible to embed fonts with a
specific unicode range via this syntax.  It doesn't appear to be.

[Embed(systemFont='Symbol', fontName='mySymbol',
mimeType='application/x-font')]
var myFont:Class;

I know you can use @font-face, which appears to automatically generate a
variable in the class, but its not a consistently named variable. I am
sure a utility function in the class could be used to ferret out that
variable name.


Daniel Freiman wrote:

 I altered the code a little and got it half working.  It works if
 you're setting the imported font using setStyle, but not if you're
 setting the font through the TextFormat object.  Simply add the lines:

 var content:DisplayObject = ldr.content;
 var c:Class = content[myFont];
 Font.registerFont(c);

 to the begining of onloadercomplete.

 I'm going to continue working on how to get the font to show up
 through TextFormat.


 On 8/29/06, * Daniel Wabyick* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 I just tried to dynamically load a font at runtime, and the
 results are
 not too promising.

 For other's benefits, here is what I did:

 - Created an AS3 project and generated a SWF (SymbolEmbed.swf)
 with the
 Symbol font embedded.

 - Verified the font is available in the SWF via Font.enumerateFonts();

 - Loaded SymbolEmbed.swf into a Flex app using the Loader class,
 following instructions to keep the SWF's on the same
 applicationDomain.

 - Checked if the font is available to the Flex app, it is not.

 Please let me know if anyone has any ideas,

 -Daniel




 Code: AS3 project with embedded font.
 ---
 public class SymbolInclude extends Sprite
 {
 public function SymbolInclude()
 {
 [Embed(systemFont='Symbol', fontName='mySymbol',
 mimeType='application/x-font')]
 var myFont:Class;

 trace(here in SymbolInclude);
 var fontList : Array = Font.enumerateFonts();
 for ( var i:String in fontList )
 {
 trace(font:  + Font( fontList[i] ).fontName);
 }
 }
 }


 Code: Loader code in Flex app.
 ---

 mx:Script
  ![CDATA[

  private var ldr:Loader;
  private function onInit() : void
  {
  showFonts();

  var context:LoaderContext = new LoaderContext();
  //context.securityDomain =
 SecurityDomain.currentDomain;
  context.applicationDomain =
 ApplicationDomain.currentDomain;

  ldr = new Loader();
  ldr.contentLoaderInfo.addEventListener(
 Event.COMPLETE,
 onLoaderComplete );
  ldr.load( new URLRequest( SymbolInclude.swf),
 context );
  }

  private function onLoaderComplete(e:Event) : void
  {
  trace(onLoaderComplete: );
  showFonts();
  }

  public function showFonts():void {
  trace(showFonts());
   var fontList : Array = Font.enumerateFonts ();
 for ( var i:String in fontList )
 {
 trace(font:  + Font( fontList[i]
 ).fontName);
 }
}
  ]]
  /mx:Script






 Daniel Freiman wrote:
 
  I have this question too but it hasn't reached the top of my to-do
  list yet.  What I'm hoping is that is that you can embed a font
 in a
  swf and then load that swf at runtime using a swfloader.
 
  On 8/28/06, *Daniel Wabyick*  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  mailto: [EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL 
 PROTECTED]  wrote:
 
  Hey guys,
 
  Is there any way to include a font at runtime using Flex
 2?  There
  was a
  weird hack that works in Flash 8 where you load a movie that
 loads an
  RSL. Does anything like this work in Flex 2 ?
 
  Thanks,
  -Daniel
 
 
  --
  Flexcoders Mailing List
  FAQ:

 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

RE: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Brian Deitte
Title: Re: [flexcoders] Embedding fonts at runtime





One addition to this, which is that we always include the 
space character when you specify the unicode range. I'm not sure the 
original reasoning for this, but I just noticed it in the code. Also, you 
can specify multiple ranges, separated by commas. 
-Brian

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Dirk 
  EismannSent: Wednesday, August 30, 2006 2:07 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Embedding fonts 
  at runtime
  
  
  Yes, this is 
  possible:
  
  [Embed(source="Arial.ttf", 
  fontName="myArial", unicodeRange="U+0041-U+005A" )]
  public var 
  myClass:Class;
  
  Dirk.
  
  
  Von: flexcoders@yahoogroups.com im Auftrag von 
  Daniel WabyickGesendet: Mi 30.08.2006 18:58An: 
  flexcoders@yahoogroups.comBetreff: Re: [flexcoders] Embedding fonts 
  at runtime
  
  Awesome! I'll definitely have to check this out.On a 
  related note, I wonder if its possible to embed fonts with aspecific 
  unicode range via this syntax. It doesn't appear to 
  be.[Embed(systemFont='Symbol', 
  fontName='mySymbol',mimeType='application/x-font')]var 
  myFont:Class;I know you can use @font-face, which appears to 
  automatically generate avariable in the class, but its not a consistently 
  named variable. I amsure a utility function in the class could be used to 
  ferret out thatvariable name.Daniel Freiman 
  wrote: I altered the code a little and got it half 
  working. It works if you're setting the imported font using 
  setStyle, but not if you're setting the font through the TextFormat 
  object. Simply add the 
  lines: 
  var content:DisplayObject = 
  ldr.content; 
  var c:Class = 
  content["myFont"]; 
  Font.registerFont(c); to the begining of 
  onloadercomplete. I'm going to continue working on how to get 
  the font to show up through TextFormat. On 
  8/29/06, * Daniel Wabyick* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
  wrote: I just tried to dynamically 
  load a font at runtime, and the results 
  are not too 
  promising. For other's benefits, here 
  is what I did: - Created an AS3 
  project and generated a SWF (SymbolEmbed.swf) 
  with the Symbol font 
  embedded. - Verified the font is 
  available in the SWF via 
  Font.enumerateFonts(); - Loaded 
  SymbolEmbed.swf into a Flex app using the Loader 
  class, following instructions to keep the 
  SWF's on the same 
  applicationDomain. - Checked if the 
  font is available to the Flex app, it is 
  not. Please let me know if anyone has 
  any ideas, 
  -Daniel Code: 
  AS3 project with embedded font. 
  --- 
  public class SymbolInclude extends 
  Sprite 
  { 
  public function 
  SymbolInclude() 
  { 
  [Embed(systemFont='Symbol', 
  fontName='mySymbol', 
  mimeType='application/x-font')] 
  var 
  myFont:Class; 
  trace("here in 
  SymbolInclude"); 
  var fontList : Array = 
  Font.enumerateFonts(); 
  for ( var i:String in fontList 
  ) 
  { 
  trace("font: " + Font( fontList[i] 
  ).fontName); 
  } 
  } 
  } Code: Loader code in Flex 
  app. 
  --- 
  mx:Script 
  ![CDATA[ 
  private var 
  ldr:Loader; 
  private function onInit() : 
  void 
  { 
  showFonts(); 
  var context:LoaderContext = new 
  LoaderContext(); 
  //context.securityDomain = 
  SecurityDomain.currentDomain; 
  context.applicationDomain = 
  ApplicationDomain.currentDomain; 
  ldr = new 
  Loader(); 
  ldr.contentLoaderInfo.addEventListener( 
  Event.COMPLETE, onLoaderComplete 
  ); 
  ldr.load( new URLRequest( 
  "SymbolInclude.swf"), context 
  ); 
  } 
  private function onLoaderComplete(e:Event) : 
  void 
  { 
  trace("onLoaderComplete: 
  "); 
  showFonts(); 
  } 
  public function showFonts():void 
  { 
  trace("showFonts()"); 
  var fontList : Array = Font.enumerateFonts 
  (); 
  for ( var i:String in fontList 
  ) 
  { 
  trace("font: " + Font( fontList[i] 
  ).fontName); 
  } 
  } 
  ]] 
  /mx:Script 
  Daniel Freiman wrote: 
I have this question too but it 
  hasn't reached the top of my to-do  list 
  yet. What I'm hoping is that is that you can embed a 
  font in a  
  swf and then load that swf at runtime using a 
  swfloader. 
On 8/28/06, *Daniel Wabyick*  
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
   mailto: 
  [EMAIL PROTECTED]  wrote: 
Hey 
  guys,  
   Is there any way to include a font at runtime 
  using Flex 2? 
  There  was 
  a  weird hack that 
  works in Flash 8 where you load a movie that 
  loads an  RSL. 
  Does anything like this work in Flex 2 ? 

  Thanks,  
  -Daniel  

  --  Flexcoders 
  Mailing List  
  FAQ: 
   http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
  http://groups.yah

Re: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Daniel Freiman



I figured out how to use the textformat object. The textformat object does actually work, but a TextField will only retrieve the embeded font if it's parent has previously been sent set the font as a style. So for any component that uses a UITextField, set the fontFamily style of the parent UIComponent to the newly loaded font and then the UITextField should be able to use the font even if fontFamily is subsequently reset. I have no idea why this works, so there may be some improvements to this method.
On 8/30/06, Brian Deitte [EMAIL PROTECTED] wrote:







One addition to this, which is that we always include the 
space character when you specify the unicode range. I'm not sure the 
original reasoning for this, but I just noticed it in the code. Also, you 
can specify multiple ranges, separated by commas. 
-Brian

  
  
  From: flexcoders@yahoogroups.com 
  [mailto:flexcoders@yahoogroups.com] On Behalf Of Dirk 
  EismannSent: Wednesday, August 30, 2006 2:07 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Embedding fonts 
  at runtime
  
  
  Yes, this is 
  possible:
  
  [Embed(source=Arial.ttf, 
  fontName=myArial, unicodeRange=U+0041-U+005A )]
  public var 
  myClass:Class;
  
  Dirk.
  
  
  Von: flexcoders@yahoogroups.com im Auftrag von 
  Daniel WabyickGesendet: Mi 30.08.2006 18:58An: 
  flexcoders@yahoogroups.comBetreff: Re: [flexcoders] Embedding fonts 
  at runtime
  
  Awesome! I'll definitely have to check this out.On a 
  related note, I wonder if its possible to embed fonts with aspecific 
  unicode range via this syntax. It doesn't appear to 
  be.[Embed(systemFont='Symbol', 
  fontName='mySymbol',mimeType='application/x-font')]var 
  myFont:Class;I know you can use @font-face, which appears to 
  automatically generate avariable in the class, but its not a consistently 
  named variable. I amsure a utility function in the class could be used to 
  ferret out thatvariable name.Daniel Freiman 
  wrote: I altered the code a little and got it half 
  working. It works if you're setting the imported font using 
  setStyle, but not if you're setting the font through the TextFormat 
  object. Simply add the 
  lines: 
  var content:DisplayObject = 
  ldr.content; 
  var c:Class = 
  content[myFont]; 
  Font.registerFont(c); to the begining of 
  onloadercomplete. I'm going to continue working on how to get 
  the font to show up through TextFormat. On 
  8/29/06, * Daniel Wabyick* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] 
  wrote: I just tried to dynamically 
  load a font at runtime, and the results 
  are not too 
  promising. For other's benefits, here 
  is what I did: - Created an AS3 
  project and generated a SWF (SymbolEmbed.swf) 
  with the Symbol font 
  embedded. - Verified the font is 
  available in the SWF via 
  Font.enumerateFonts(); - Loaded 
  SymbolEmbed.swf into a Flex app using the Loader 
  class, following instructions to keep the 
  SWF's on the same 
  applicationDomain. - Checked if the 
  font is available to the Flex app, it is 
  not. Please let me know if anyone has 
  any ideas, 
  -Daniel Code: 
  AS3 project with embedded font. 
  --- 
  public class SymbolInclude extends 
  Sprite 
  { 
  public function 
  SymbolInclude() 
  { 
  [Embed(systemFont='Symbol', 
  fontName='mySymbol', 
  mimeType='application/x-font')] 
  var 
  myFont:Class; 
  trace(here in 
  SymbolInclude); 
  var fontList : Array = 
  Font.enumerateFonts(); 
  for ( var i:String in fontList 
  ) 
  { 
  trace(font:  + Font( fontList[i] 
  ).fontName); 
  } 
  } 
  } Code: Loader code in Flex 
  app. 
  --- 
  mx:Script 
  ![CDATA[ 
  private var 
  ldr:Loader; 
  private function onInit() : 
  void 
  { 
  showFonts(); 
  var context:LoaderContext = new 
  LoaderContext(); 
  //context.securityDomain = 
  SecurityDomain.currentDomain; 
  context.applicationDomain = 
  ApplicationDomain.currentDomain; 
  ldr = new 
  Loader(); 
  ldr.contentLoaderInfo.addEventListener( 
  Event.COMPLETE, onLoaderComplete 
  ); 
  ldr.load( new URLRequest( 
  SymbolInclude.swf), context 
  ); 
  } 
  private function onLoaderComplete(e:Event) : 
  void 
  { 
  trace(onLoaderComplete: 
  ); 
  showFonts(); 
  } 
  public function showFonts():void 
  { 
  trace(showFonts()); 
  var fontList : Array = Font.enumerateFonts 
  (); 
  for ( var i:String in fontList 
  ) 
  { 
  trace(font:  + Font( fontList[i] 
  ).fontName); 
  } 
  } 
  ]] 
  /mx:Script 
  Daniel Freiman wrote: 
I have this question too but it 
  hasn't reached the top of my to-do  list 
  yet. What I'm hoping is that is that you can embed a 
  font in a  
  swf and then load that swf at runtime using a 
  swfloader. 
On 8/28/06, *Daniel Wabyick*  
  [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] 
   mailto: 
  [EMAIL PROTECTED]  wrote: 
Hey 
  guys,  
   Is there any way to include a font at runtime 
  using Flex 2? 
  There  was 
  a  weird hack that 
  works

RE: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Tom Lee
Title: Re: [flexcoders] Embedding fonts at runtime










Just wondering, is [Embed] directive
compile-time, or run-time?











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Brian Deitte
Sent: Wednesday, August 30, 2006
2:43 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders]
Embedding fonts at runtime





One addition to this, which is that we
always include the space character when you specify the unicode range.
I'm not sure the original reasoning for this, but I just noticed it in the
code. Also, you can specify multiple ranges, separated by commas.
-Brian











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Dirk Eismann
Sent: Wednesday, August 30, 2006
2:07 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders]
Embedding fonts at runtime





Yes, this is possible:











[Embed(source=Arial.ttf,
fontName=myArial, unicodeRange=U+0041-U+005A )]





public var myClass:Class;











Dirk.













Von: flexcoders@yahoogroups.com im Auftrag von Daniel
Wabyick
Gesendet: Mi 30.08.2006 18:58
An: flexcoders@yahoogroups.com
Betreff: Re: [flexcoders]
Embedding fonts at runtime







Awesome! I'll definitely have to check this out.

On a related note, I wonder if its possible to embed fonts with a
specific unicode range via this syntax. It doesn't appear to be.

[Embed(systemFont='Symbol', fontName='mySymbol',
mimeType='application/x-font')]
var myFont:Class;

I know you can use @font-face, which appears to automatically generate a
variable in the class, but its not a consistently named variable. I am
sure a utility function in the class could be used to ferret out that
variable name.


Daniel Freiman wrote:

 I altered the code a little and got it half working. It works if
 you're setting the imported font using setStyle, but not if you're
 setting the font through the TextFormat object. Simply add the
lines:


var content:DisplayObject = ldr.content;

var c:Class = content[myFont];

Font.registerFont(c);

 to the begining of onloadercomplete.

 I'm going to continue working on how to get the font to show up
 through TextFormat.


 On 8/29/06, * Daniel Wabyick* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
wrote:

 I just tried to dynamically load a font at
runtime, and the
 results are
 not too promising.

 For other's benefits, here is what I did:

 - Created an AS3 project and generated a SWF
(SymbolEmbed.swf)
 with the
 Symbol font embedded.

 - Verified the font is available in the SWF via
Font.enumerateFonts();

 - Loaded SymbolEmbed.swf into a Flex app using the
Loader class,
 following instructions to keep the SWF's on the
same
 applicationDomain.

 - Checked if the font is available to the Flex
app, it is not.

 Please let me know if anyone has any ideas,

 -Daniel




 Code: AS3 project with embedded font.
 ---
 public class SymbolInclude
extends Sprite
 {

public function SymbolInclude()
 {

[Embed(systemFont='Symbol', fontName='mySymbol',
 mimeType='application/x-font')]

var myFont:Class;


trace(here in SymbolInclude);

var fontList : Array = Font.enumerateFonts();

for ( var i:String in fontList )

{

trace(font:  + Font( fontList[i] ).fontName);

}
 }
 }


 Code: Loader code in Flex app.
 ---

 mx:Script

![CDATA[


private var ldr:Loader;

private function onInit() : void

{

showFonts();


var context:LoaderContext = new LoaderContext();

//context.securityDomain =
 SecurityDomain.currentDomain;

context.applicationDomain =
 ApplicationDomain.currentDomain;


ldr = new Loader();

ldr.contentLoaderInfo.addEventListener(
 Event.COMPLETE,
 onLoaderComplete );

ldr.load( new URLRequest( SymbolInclude.swf),
 context );

}


private function onLoaderComplete(e:Event) : void

{

trace(onLoaderComplete: );

showFonts();

}


public function showFonts():void {

trace(showFonts());

var fontList : Array = Font.enumerateFonts ();

for ( var i:String in fontList )

{

trace(font:  + Font( fontList[i]
 ).fontName);

}

}

]]
 /mx:Script






 Daniel Freiman wrote:
 
  I have this question too but it hasn't
reached the top of my to-do
  list yet. What I'm hoping is that is
that you can embed a font
 in a
  swf and then load that swf at runtime using a
swfloader.
 
  On 8/28/06, *Daniel Wabyick* 
[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  mailto:
[EMAIL PROTECTED]  wrote:
 
  Hey guys,
 
  Is there any way to
include a font at runtime using Flex
 2? There
  was a
  weird hack that works
in Flash 8 where you load a movie that
 loads an
  RSL. Does anything
like this work in Flex 2 ?
 
  Thanks,
  -Daniel
 
 
  --
  Flexcoders Mailing
List
  FAQ:
 
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  http

RE: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Matt Horn
[Embed] is always at compile time, so I dont think this solution matches
your requirements of loading teh fonts at run time.

-m 

 -Original Message-
 From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lee
 Sent: Wednesday, August 30, 2006 4:01 PM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Embedding fonts at runtime
 
 Just wondering, is [Embed] directive compile-time, or run-time?
 
  
 
 
 
 From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of Brian Deitte
 Sent: Wednesday, August 30, 2006 2:43 PM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Embedding fonts at runtime
 
  
 
 One addition to this, which is that we always include the 
 space character when you specify the unicode range.  I'm not 
 sure the original reasoning for this, but I just noticed it 
 in the code.  Also, you can specify multiple ranges, 
 separated by commas.  -Brian
 

 
   
 
 
 
   From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann
   Sent: Wednesday, August 30, 2006 2:07 PM
   To: flexcoders@yahoogroups.com
   Subject: RE: [flexcoders] Embedding fonts at runtime
 
   Yes, this is possible:
 

 
   [Embed(source=Arial.ttf, fontName=myArial, 
 unicodeRange=U+0041-U+005A )]
 
   public var myClass:Class;
 

 
   Dirk.
 

 
   
 
 
 
   Von: flexcoders@yahoogroups.com im Auftrag von Daniel Wabyick
   Gesendet: Mi 30.08.2006 18:58
   An: flexcoders@yahoogroups.com
   Betreff: Re: [flexcoders] Embedding fonts at runtime
 
   Awesome! I'll definitely have to check this out.
   
   On a related note, I wonder if its possible to embed 
 fonts with a
   specific unicode range via this syntax.  It doesn't 
 appear to be.
   
   [Embed(systemFont='Symbol', fontName='mySymbol',
   mimeType='application/x-font')]
   var myFont:Class;
   
   I know you can use @font-face, which appears to 
 automatically generate a
   variable in the class, but its not a consistently named 
 variable. I am
   sure a utility function in the class could be used to 
 ferret out that
   variable name.
   
   
   Daniel Freiman wrote:
   
I altered the code a little and got it half working.  
 It works if
you're setting the imported font using setStyle, but 
 not if you're
setting the font through the TextFormat object.  
 Simply add the lines:
   
var content:DisplayObject = ldr.content;
var c:Class = content[myFont];
Font.registerFont(c);
   
to the begining of onloadercomplete.
   
I'm going to continue working on how to get the font 
 to show up
through TextFormat.
   
   
On 8/29/06, * Daniel Wabyick* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED]  wrote:
   
I just tried to dynamically load a font at 
 runtime, and the
results are
not too promising.
   
For other's benefits, here is what I did:
   
- Created an AS3 project and generated a SWF 
 (SymbolEmbed.swf)
with the
Symbol font embedded.
   
- Verified the font is available in the SWF via 
 Font.enumerateFonts();
   
- Loaded SymbolEmbed.swf into a Flex app using 
 the Loader class,
following instructions to keep the SWF's on the same
applicationDomain.
   
- Checked if the font is available to the Flex 
 app, it is not.
   
Please let me know if anyone has any ideas,
   
-Daniel
   
   
   
   
Code: AS3 project with embedded font.
---
public class SymbolInclude extends Sprite
{
public function SymbolInclude()
{
[Embed(systemFont='Symbol', 
 fontName='mySymbol',
mimeType='application/x-font')]
var myFont:Class;
   
trace(here in SymbolInclude);
var fontList : Array = Font.enumerateFonts();
for ( var i:String in fontList )
{
trace(font:  + Font( 
 fontList[i] ).fontName);
}
}
}
   
   
Code: Loader code in Flex app.
---
   
mx:Script
 ![CDATA[
   
 private var ldr:Loader;
 private function onInit() : void

Re: [flexcoders] Embedding fonts at runtime

2006-08-30 Thread Daniel Wabyick

Right, to clarify the title of the thread should have been Dynamically 
loading embedded fonts at runtime ...

This feature is critical if you want to use embedded fonts for a 
localized application. Determine the locale, and load a SWF containing a 
font, or possibly a unicode subset of the font (e.g. for Arial Unicode 
MS). 

Based on Daniel Friemen's successful experiments, it seems like this 
will be possible, but hopefully future versions of Flex will support 
this more elegantly.

Best,
-Daniel



Matt Horn wrote:

 [Embed] is always at compile time, so I dont think this solution matches
 your requirements of loading teh fonts at run time.

 -m

  -Original Message-
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com] On Behalf Of Tom Lee
  Sent: Wednesday, August 30, 2006 4:01 PM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Subject: RE: [flexcoders] Embedding fonts at runtime
 
  Just wondering, is [Embed] directive compile-time, or run-time?
 
 
 
  
 
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com] On Behalf Of Brian Deitte
  Sent: Wednesday, August 30, 2006 2:43 PM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Subject: RE: [flexcoders] Embedding fonts at runtime
 
 
 
  One addition to this, which is that we always include the
  space character when you specify the unicode range. I'm not
  sure the original reasoning for this, but I just noticed it
  in the code. Also, you can specify multiple ranges,
  separated by commas. -Brian
 
 
 
 
  
 
 
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com] On Behalf Of Dirk Eismann
  Sent: Wednesday, August 30, 2006 2:07 PM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Subject: RE: [flexcoders] Embedding fonts at runtime
 
  Yes, this is possible:
 
 
 
  [Embed(source=Arial.ttf, fontName=myArial,
  unicodeRange=U+0041-U+005A )]
 
  public var myClass:Class;
 
 
 
  Dirk.
 
 
 
 
  
 
 
  Von: flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com im Auftrag von Daniel Wabyick
  Gesendet: Mi 30.08.2006 18:58
  An: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
  Betreff: Re: [flexcoders] Embedding fonts at runtime
 
  Awesome! I'll definitely have to check this out.
 
  On a related note, I wonder if its possible to embed
  fonts with a
  specific unicode range via this syntax. It doesn't
  appear to be.
 
  [Embed(systemFont='Symbol', fontName='mySymbol',
  mimeType='application/x-font')]
  var myFont:Class;
 
  I know you can use @font-face, which appears to
  automatically generate a
  variable in the class, but its not a consistently named
  variable. I am
  sure a utility function in the class could be used to
  ferret out that
  variable name.
 
 
  Daniel Freiman wrote:
  
   I altered the code a little and got it half working.
  It works if
   you're setting the imported font using setStyle, but
  not if you're
   setting the font through the TextFormat object.
  Simply add the lines:
  
   var content:DisplayObject = ldr.content;
   var c:Class = content[myFont];
   Font.registerFont(c);
  
   to the begining of onloadercomplete.
  
   I'm going to continue working on how to get the font
  to show up
   through TextFormat.
  
  
   On 8/29/06, * Daniel Wabyick* [EMAIL PROTECTED] 
 mailto:daniel%40wabysabi.com
   mailto:[EMAIL PROTECTED] mailto:daniel%40wabysabi.com
  mailto:[EMAIL PROTECTED] mailto:daniel%40wabysabi.com  wrote:
  
   I just tried to dynamically load a font at
  runtime, and the
   results are
   not too promising.
  
   For other's benefits, here is what I did:
  
   - Created an AS3 project and generated a SWF
  (SymbolEmbed.swf)
   with the
   Symbol font embedded.
  
   - Verified the font is available in the SWF via
  Font.enumerateFonts();
  
   - Loaded SymbolEmbed.swf into a Flex app using
  the Loader class,
   following instructions to keep the SWF's on the same
   applicationDomain.
  
   - Checked if the font is available to the Flex
  app, it is not.
  
   Please let me know if anyone has any ideas,
  
   -Daniel
  
  
  
  
   Code: AS3 project with embedded font.
   ---
   public class SymbolInclude extends Sprite
   {
   public function SymbolInclude()
   {
   [Embed(systemFont='Symbol',
  fontName='mySymbol',
   mimeType='application/x-font')]
   var myFont:Class;
  
   trace(here in SymbolInclude);
   var fontList : Array = Font.enumerateFonts();
   for ( var i:String in fontList )
   {
   trace(font:  + Font(
  fontList[i] ).fontName);
   }
   }
   }
  
  
   Code: Loader code in Flex app

Re: [flexcoders] Embedding fonts at runtime

2006-08-29 Thread Daniel Freiman



I have this question too but it hasn't reached the top of my to-do list yet. What I'm hoping is that is that you can embed a font in a swf and then load that swf at runtime using a swfloader.
On 8/28/06, Daniel Wabyick [EMAIL PROTECTED] wrote:
Hey guys,Is there any way to include a font at runtime using Flex 2?There was aweird hack that works in Flash 8 where you load a movie that loads anRSL. Does anything like this work in Flex 2 ?Thanks,
-Daniel--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/* To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:http://docs.yahoo.com/info/terms/

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Embedding fonts at runtime

2006-08-29 Thread Daniel Wabyick
I just tried to dynamically load a font at runtime, and the results are 
not too promising.

For other's benefits, here is what I did:

- Created an AS3 project and generated a SWF (SymbolEmbed.swf) with the 
Symbol font embedded.

- Verified the font is available in the SWF via Font.enumerateFonts();

- Loaded SymbolEmbed.swf into a Flex app using the Loader class, 
following instructions to keep the SWF's on the same applicationDomain.

- Checked if the font is available to the Flex app, it is not.

Please let me know if anyone has any ideas,

-Daniel




Code: AS3 project with embedded font.
---
public class SymbolInclude extends Sprite
{
public function SymbolInclude()
{
[Embed(systemFont='Symbol', fontName='mySymbol', 
mimeType='application/x-font')]
var myFont:Class;
   
trace(here in SymbolInclude);
var fontList : Array = Font.enumerateFonts();
for ( var i:String in fontList )
{
trace(font:  + Font( fontList[i] ).fontName);
}
}
}


Code: Loader code in Flex app.
---

mx:Script
 ![CDATA[

 private var ldr:Loader;
 private function onInit() : void
 {
 showFonts();

 var context:LoaderContext = new LoaderContext();
 //context.securityDomain = SecurityDomain.currentDomain;
 context.applicationDomain = 
ApplicationDomain.currentDomain;
  
 ldr = new Loader();
 ldr.contentLoaderInfo.addEventListener( Event.COMPLETE, 
onLoaderComplete );
 ldr.load( new URLRequest( SymbolInclude.swf), context );
 }

 private function onLoaderComplete(e:Event) : void
 {
 trace(onLoaderComplete: );
 showFonts();
 }

 public function showFonts():void {
 trace(showFonts());
  var fontList : Array = Font.enumerateFonts();
for ( var i:String in fontList )
{
trace(font:  + Font( fontList[i] ).fontName);
}
   }
 ]]
 /mx:Script






Daniel Freiman wrote:

 I have this question too but it hasn't reached the top of my to-do 
 list yet.  What I'm hoping is that is that you can embed a font in a 
 swf and then load that swf at runtime using a swfloader.

 On 8/28/06, *Daniel Wabyick* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Hey guys,

 Is there any way to include a font at runtime using Flex 2?  There
 was a
 weird hack that works in Flash 8 where you load a movie that loads an
 RSL. Does anything like this work in Flex 2 ?

 Thanks,
 -Daniel


 --
 Flexcoders Mailing List
 FAQ:
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.com
 http://www.mail-archive.com/flexcoders%40yahoogroups.com
 Yahoo! Groups Links

 http://groups.yahoo.com/group/flexcoders/

 mailto:[EMAIL PROTECTED]

 http://docs.yahoo.com/info/terms/





  



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/