If you use 2.0, I think this is doable, although you'll need to write
some AS code.
Fonts in RSLs are available to the application because they are loaded
to the same application domain as the app itself.
Fonts in child application domains are (probably? I should check
this...) not accessible to the application. Fonts have a semi-useless
AS3 facade; this will hopefully improve, but for now they're mostly
old-sk00l Flash tech.
Note that the Flex UI controls do some magic about checking the faces
found in the embedded font list hanging off the system manager. This
list is built because there is no native way to introspect what classes
are embedded at runtime (grr!) The low-level Flash TextField stuff
doesn't care about this list, of course, so for initially getting the
dynamic aspect working, I'd first try building things using TextFields
and the low-level Flash API, then move to "fooling" the Flex frameworks
via the embedded font list.
Here's a snippet from UITextFormat:
var sm:ISystemManager = systemManager;
if (font)
measurementTextField.embedFonts =
isFontFaceEmbedded( sm, this );
else
measurementTextField.embedFonts = false;
where isFontFaceEmbedded is:
public static function isFontFaceEmbedded(sm:ISystemManager,
textFormat:TextFormat):Boolean
{
var fontName:String = textFormat.font;
if (!fontName || !sm || !sm.embeddedFontList ||
!sm.embeddedFontList[fontName])
{
return false;
}
var info:Object = sm.embeddedFontList[fontName];
return !((textFormat.bold && !info.bold) || (textFormat.italic
&& !info.italic) || (!textFormat.bold && !textFormat.italic &&
!info.plain));
}
-Roger
Roger Gonzalez
mailto:[EMAIL PROTECTED]
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of pkleppner
> Sent: Wednesday, November 16, 2005 9:06 AM
> To: [email protected]
> Subject: [flexcoders] downloading fonts dynamically
>
> I'm looking for a mechanism to download embedded fonts dynamically,
> i.e. at runtime, as the user selects them through the UI. I don't
> want to simply embed all the fonts in my SWF, because they're too
> large. And putting them into an RSL doesn't do what I want either,
> because the entire RSL still has to get preloaded. I would
> like to be
> able to selectively download just the fonts the user requests at
> runtime.
>
> I can embed fonts into SWF's that I load at runtime as children of my
> main application... but while the fonts are available within
> the child
> SWF's, I haven't seen any way to access them from the main SWF which
> loads them. RSL's somehow avoid this problem (a font inside an RSL
> *is* available to the application which loads it), but I haven't been
> able to figure out what the magic is.
>
> Any ideas? I'll happily take suggestions for either Flex 1.5 or 2.0.
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Get fast access to your favorite Yahoo! Groups. Make Yahoo!
> your home page
> http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
> --------------------------------------------------------------
> ------~->
>
> --
> 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
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
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/