We've been working on something similar in a thread called "embeding fonts at runtime" although i'm not sure it's exactly what you want.  Some of it might be useful.  First check to see if the font is actually there using Font.enumerateFonts().  Second, we're currently looking into whether the embeded font name needs to be the same as the actual font.  If the other thread is close enough jump on it, otherwise I tell you if anything comes up that may be applicable.

On 8/30/06, Lance Linder <[EMAIL PROTECTED]> wrote:

I have been scowering the internet for information on how to embed fonts in an RSL for Flex2.

 

I ran accress this posting by Darron Schall but it looks like it is for Flex 1.5? Anyway I gave it a try but it doesn't work for me. I set up 2 projects, 1 regular flex project and another as a library project. My regular project references the library project as an RSL and in my library project I created one component with the @font-face css tag in the <mx:Style> tag. I also created a manifest file and set up the library project to use the manifest file.

 

Everything compiles right and my component from the RSL shows up in my main app but when I try to use the font in the RSL the text in my main app disappears (ie just like in Flash if you tell it to use embedded fonts but the font doesn't exist).

 

This has to be possible with Flex 2! Heck fonts alone are one of the most important things to stuff in an RSL half the time!

 

What am I doing wrong? Is there some more documentation on this that I missed or a more recent blog post that I missed?

 

Thanks for any help!

 

Here is the code I haveā€¦..

 

--- application code ---

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:mystuff="http://mystuff" layout="absolute">

            <mx:Style>

                        <![CDATA[

                                    TextArea {

                                                font-family: mainFont;    

                                    }

                        ]]>

            </mx:Style>

           

            <mystuff:MyStuff width="10" height="10" />

            <mx:TextArea x="10" y="10" width="533" height="434" text="Hello There!"/>

</mx:Application>

 

--- rsl component code ---

<?xml version="1.0" encoding="utf-8"?>

<mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="10" height="10"  backgroundColor="0x000000">

            <mx:Style>

                        <![CDATA[

                                    @font-face {

                                                src:url("verdana.ttf");

                                                font-family: mainFont;

                                                font-style: normal;         

                                    }

                        ]]>

            </mx:Style>

</mx:Canvas>

 

--- manifest file ---

<?xml version="1.0"?>

<componentPackage>

    <component id="MyStuff" class="MyStuff"/>

</componentPackage>


__._,_.___

--
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




__,_._,___

Reply via email to