Everything I create has to be translated into multiple languages. We store all the text in XML, and the SWF loads a different XML based on the language setting. This works fine and keeps the translation department happy.
The frustrating part is with the embedded fonts. All textfields use styles loaded from an external CSS file. Which works fine, as long as the font defined in the CSS is embedded within the SWF. Because the fonts are embedded in the SWF and are not externally loaded, we have to make several published copies of the SWF for the different languages that need different embedded fonts, ie: chinese, japanese, etc.
I've been exploring ways to have different external SWFs for each language that needs different embedded fonts, so that the XML for each language would link a different embedded font SWF to load. I've ran into many road blocks other developers have ran into and fear that the final conclusion is that it can not be done.
Listed below are the different ways I have tried:
Main SWF = main movie that loads the external font SWF
Font SWF = SWF containing embedded fonts
------------------------
Setup:
Font SWF contains a MovieClip in the library that contains a dynamic textfield for each font I want to embed. Each textfield has the proper character outlines embedded. The movieclip has export for actionscript set with linkage id name.
Main SWF contains a dynamic textfield with no embedded fonts
Action:
Main SWF loads Font SWF, then after load complete, set textfield with embedFonts = true and sets textFormat to it with a font which matchs one of the embedded from Font SWF
Result:
Font SWF appears on screen, the textfield on Main SWF has text in it (select all then copy show that the text is there), but is blank because of no embedded font.
------------------------
------------------------
Setup:
Font SWF contains in the library a font object for every font I need for that langauge. Each font has export for actionscript set with linkage id name.
Main SWF contains a dynamic textfield with no embedded fonts
Action:
Main SWF loads Font SWF, then after load complete, set textfield with embedFonts = true and sets textFormat to it with a font which matchs one of the embedded from Font SWF
Result:
The textfield on Main SWF has text in it (select all then copy show that the text is there), but is blank because of no embedded font.
------------------------
------------------------
Setup:
Font SWF contains a MovieClip in the library that contains a dynamic textfield for each font I want to embed. Each textfield has the proper character outlines embedded. the movieclip has export for runtime sharing set with linkage id name.
Main SWF contains a dynamic textfield with no embedded fonts and a movieclip that links to the Font SWFs movieclip from its library.
Action:
Set textfield with embedFonts = true and sets textFormat to it with a font which matchs one of the embedded from the shared movieclip asset.
Result:
The textfield on Main SWF has text in it (select all then copy show that the text is there), but is blank because of no embedded font. Plus the shared movieclip asset is loading into the Main SWF at publish not during runtime.
------------------------
Many others have tried many many other ways to get around this, it basicly comes down to that you can only embed fonts if the font is within the main SWF and the fonts are added into memory at publish, not runtime. :doh:
ehi, i've got similar probl and despite many tries and searching can work it out. gave a look at sharedfonts but not sure how use it (can't understand as 1...)
i'm to build a site in english- german and korean, this site loads all texts from an xml file.
the file is utf8 so if i copy and paste from the word.doc i received by the client, i can write my node element in korean.
when the xml is loaded i apply a textFormat with a different font (ie: arial 4 english, helvetica 4 german and Batang 4 korean - i use batang caus it's the only font showing korean glyphs, on my pc).
the problem is embedding these font (specially the charset). i attach the font in the library with a linkage. it works fine and i can see everything. if i try the file on a pc who hasn't got that font though, it shows only odd chars...
this is due to the fact that the embedding for Batang happens only for the occidental characthers of it (while the others are ignored...)
i cannot embed the font directly in the text field because the swf goes to 4M ..!!!
any suggestions?
on macromedia i read about "XML font embedding table" but didn't really understand its use..
I have a method of loading fonts from external files that work fine, except the file you're loading into can't contain any static textfields that use the same font name. Otherwise it's fine. I'll post soon.
Your question greatly interested me, and so I spent some time looking into this. I eventually found a very well done implementation of this technique. See http://www.sharedfonts.com/eng/index.html .
Go to the bottom and check out the swf demo. There is also a link to download the demo so you can see how everything was done.
I just found the post: http://bryanlangdon.com/blog/2007/03...cript-2-and-3/
which explains how to do it.
Gets kind of complicated but I got it to work on a project where I ask them their language right off the bat, and then load only whats needed
I have a little question. Can I write a dynamic URL into "Import for runtime sharing URL"?
I want to write "index.php?action=font1&locale=ru_RU" (ru_RU can change in de_DE, us_US, etc.).
Bookmarks