To no avail, I've decided to take a different route.  I decided to make an 
ActionScript project with a class that implements ISWFContext and embeds the 
font I need.  Then from my main app I load the class in and set it on 
flowComposer's swfContext property.  This is explained well with a good example 
here:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLa
 yout/compose/ISWFContext.html

So, I make the font class implement ISWFContext and then in my app I have the 
following:

------------------------

var fonter:Object = loader.content;
trace(describeType(fonter));
trace(fonter is ISWFContext);
editor.textFlow.flowComposer.swfContext = ISWFContext(fonter);

------------------------

On the describeType trace it shows:

------------------------

<type name="Fonter" base="flash.display::Sprite" isDynamic="false" 
isFinal="false" isStatic="false">
  <metadata name="__go_to_ctor_definition_help">
    <arg key="file" value="C:\Development\TLF\Fonter\src\Fonter.as"/>
    <arg key="pos" value="371"/>
  </metadata>
  <metadata name="__go_to_definition_help">
    <arg key="file" value="C:\Development\TLF\Fonter\src\Fonter.as"/>
    <arg key="pos" value="169"/>
  </metadata>
  <extendsClass type="flash.display::Sprite"/>
  <extendsClass type="flash.display::DisplayObjectContainer"/>
  <extendsClass type="flash.display::InteractiveObject"/>
  <extendsClass type="flash.display::DisplayObject"/>
  <extendsClass type="flash.events::EventDispatcher"/>
  <extendsClass type="Object"/>
  <implementsInterface type="flash.display::IBitmapDrawable"/>
  <implementsInterface type="flashx.textLayout.compose::ISWFContext"/>
  ...

------------------------ 

Notice it shows the class as implementing ISWFContext as planned.  But on the 
next line I trace whether fonter is of type ISWFContext and it reports false.  
On the next line where I attempt to cast it to ISWFContext I get the following 
error:

TypeError: Error #1034: Type Coercion failed: cannot convert fon...@a32ce81 to 
flashx.textLayout.compose.ISWFContext.
     at 
TLFTester/fontLoadedHandler()[C:\Development\TLF\TLFTester\src\TLFTester.mxml:70]


I'm going crazy over here.  The app is built using the flex 3.3 sdk.  The font 
swf is built using the flex 4 sdk.  The textLayout.swc should be the same (I 
pulled the textLayout.swc from the flex 4 sdk to use in our flex 3.3 app).

Any ideas?

BTW, does Adobe offer any sort of official developer support?  We'd gladly pay 
consulting rates as we're in the midst of a large, expensive project.

Thanks,

Aaron

--- In flexcoders@yahoogroups.com, Alex Harui <aha...@...> wrote:
>
> If you're trying to load the font by placing it in an RSL, make sure it is 
> last in the list of RSLs to load ( or at least not first or second).
> 
> 
> On 5/6/10 10:42 AM, "aaronius9er9er" <aaronius...@...> wrote:
> 
> 
> 
> 
> 
> 
> Strange.  When I link to the library project using "Merged into code" it 
> works, but when linking to it as an RSL it throws the following error when 
> running the app:
> 
> VerifyError: Error #1014: Class mx.core::FontAsset could not be found.
> 
> Google doesn't have a whole lot to say on the issue. I get this error even if 
> I compile my font library project using the 3.3 SDK.
> 
> Aaron
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , 
> "aaronius9er9er" <aaronius9er@> wrote:
> >
> > Nevermind, that's related to my code.  More testing to come...
> >
> > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , 
> > "aaronius9er9er" <aaronius9er@> wrote:
> > >
> > > Thanks for the response. I created a library project with an 
> > > EmbeddedFonts class compiled using the Flex 4 sdk.  I then linked to the 
> > > library and made sure the app was referencing the class:
> > >
> > > protected var fontsLinkage:EmbeddedFonts;
> > >
> > > but then I get the following error when attempting to run the app:
> > >
> > > TypeError: Error #1034: Type Coercion failed: cannot convert 
> > > _tlftester_mx_managers_systemmana...@139860b1 to 
> > > flashx.textLayout.compose.ISWFContext.
> > > at 
> > > TLFTester/fontLoadedHandler()[C:\Development\TLF\TLFTester\src\TLFTester.mxml:52]
> > > at 
> > > TLFTester/application1_creationCompleteHandler()[C:\Development\TLF\TLFTester\src\TLFTester.mxml:25]
> > > at 
> > > TLFTester/___TLFTester_Application1_creationComplete()[C:\Development\TLF\TLFTester\src\TLFTester.mxml:3]
> > > at flash.events::EventDispatcher/dispatchEventFunction()
> > > at flash.events::EventDispatcher/dispatchEvent()
> > > at 
> > > mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9308]
> > > at mx.core::UIComponent/set 
> > > initialized()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
> > > at 
> > > mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
> > > at Function/http://adobe.com/AS3/2006/builtin::apply()
> > > at 
> > > mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8633]
> > > at 
> > > mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8573]
> > >
> > > I would assume it's due to a difference in SDKs.  You didn't run into the 
> > > same issue?
> > >
> > > Aaron
> > >
> > >
> > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , 
> > > gabriel montagné <gabriel@> wrote:
> > > >
> > > > Hello Aaron,
> > > >
> > > > On 06/05/2010, aaronius9er9er <aaronius9er@> wrote:
> > > > >
> > > > > We have an app built in Flex 3.3.  We've pulled the text layout 
> > > > > framework
> > > > > swc from Flex 4 to use in our app.  We now need to load fonts 
> > > > > dynamically at
> > > > > runtime to use within our text flow.  In my understanding, in order to
> > > >
> > > > We've also had to use the TLF with CFF fonts in a Flex 3.* app... we 
> > > > didn't
> > > > have to load them at runtime but we compiled a swc with them and linked 
> > > > that on
> > > > the main app.
> > > >
> > > > Perhaps you could do something like that with a RSL if you need to load 
> > > > them
> > > > dynamically.
> > > >
> > > > But, most importantly, for the fonts to be linked you don't really need 
> > > > the swf
> > > >  compiled with the new sdk to be a full flex app.  In our case it was 
> > > > just a
> > > > plain class with the fonts embedded:
> > > >
> > > > package uk.co.razorfish.fonts
> > > > {
> > > >
> > > > /**
> > > >  *  This class embedds the fonts needed for the TLF which is used for 
> > > > the
> > > >     ...
> > > >  */
> > > > public class EmbeddedFonts
> > > > {
> > > >
> > > >     [Embed(
> > > >         source="tt1047m_.ttf",
> > > >         fontFamily="Industrial736 BT",
> > > >         fontStyle="regular",
> > > >         cff="true",
> > > >         advancedAntiAliasing="true",
> > > >         unicodeRange="U+0020-007F, U+00A0-00FF, U+2010-201F,
> > > > U+2032-2037, U+2039-203A, U+20A0-20B5"
> > > >     )]
> > > >     public static const INDUSTRIAL_ROMAN:Class;
> > > >
> > > >     [Embed(
> > > >         source="tt1048m_.ttf",
> > > >         fontFamily="Industrial736 BT",
> > > >         fontStyle="italic",
> > > >         cff="true",
> > > >         advancedAntiAliasing="t
> > > >
> > > > ... etc.
> > > >
> > > > Because we needed to load them up front, on the main app, we just 
> > > > linked that
> > > > class,
> > > >
> > > > import uk.co.razorfish.fonts.EmbeddedFonts; EmbeddedFonts;
> > > >
> > > > And that did the job.
> > > >
> > > > HTH,
> > > > Gabriel
> > > >
> > > > --
> > > > gabriel montagné láscaris comneno
> > > > http://rojored.com
> > > > +44 (0) 7500 709 209
> > > >
> > >
> >
> 
> 
> 
> 
> 
> 
> --
> Alex Harui
> Flex SDK Team
> Adobe System, Inc.
> http://blogs.adobe.com/aharui
>


Reply via email to