Has anyone been able to embed a font in a shared library to use across
multiple Flex-created .swf files? Specifically, I have this line of
code in a .sws file:
<embed source="../fonts/Arial.ttf" newSymbol="mainFont" />
And it always complains that Arial.ttf can't be found. I know the first
think you'll think of is that the path is incorrect, but I can say
without a doubt that it's *not* a path issue. The font is in the right
location, the relative path is correct, I can see the file on my
harddrive, all of the cases are correct (even though I'm using Windows
so that shouldn't matter anyway).
I have a modular Flex app (i.e. a Flex .swf that loads other Flex
created .swfs). I'd like them all to use the same embedded font, the
user should only have to download the font one time, and I'd like to be
able to update the font in one location to have all of the .swfs use
that font.
I tried putting the font in the main .swf, like this (in a .css file
including in compilation):
@font-face {
src: url("../fonts/Arial.ttf");
fontFamily: mainFont;
}
Application {
fontFamily: mainFont;
}
... and that works fine for all of the fonts in the main .swf, but the
fonts in the loaded .swfs turn out to be some sort of serif variant,
which means the loaded .swfs are *trying* to use the embedded font, but
they aren't getting a reference to the font correctly. I want to avoid
embedding the font in every single loaded .swf, as the user should only
need to download the glpyhs one time (hence putting the font in a shared
library).
I've done this type of thing successfully with Flash using a shared
font. When using Flash for this, I created a remote shared library with
a font in it, and then told all of the .swfs to "import for runtime
sharing" the shared font symbol. I can't seem to find the "Flex way" to
do this.
Any ideas? If not, I think I'll need to create the shared library with
a font symbol from Flash itself, and then post-process the .swf with
something like swfmill (http://iterative.org/swfmill/) to add in an
explicit reference to the library. That seems like a major workaround.
I would think something like this should be easy in Flex, but I can't
seem to figure it out. Flex's shared library handling is a million
times better than dealing with them in Flash, minus this shared fonts
issue that I can't seem to work around yet. I know using shared fonts
in Flash was a royal pain in the butt (all kinds of issues with breaking
TextFormat, not importing correctly, etc).. but I was hoping the process
would have been ironed out in Flex. Maybe I'm just missing something?
-d
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/