views:

778

answers:

3

Hi, I'm working on a multilingual flex application that has to run in 27+ languages, including asian, hebrew and arabic, as well as all european languages.

We work with an embedded font (Myriad Pro) and have plenty of styles in a css that make use of that embedded font. We've tested with a modified version of Myriad including all non western unicode chars taken from Arial Unicode and it works ok, but the weight of the swf is unacceptable.

We have this two lines in our css..

@font-face 
{
    src: url("MyriadPro-Semibold.otf");
    fontFamily: "Default Font";
    fontWeight: bold;
    advancedAntiAliasing: true;
}
@font-face 
{
    src: url("MyriadPro-Regular.otf");
    fontFamily: "Default Font";
    advancedAntiAliasing: true;
}

and the rest of stlyes use the "Default Font" when needed.

What is the best solution for implementing the multilingual apps with runtime loading fonts, while maintaining the current stylesheet?

A: 

Rather than having the font and the language files embedded in the .swf shouldn't you be downloading them from the server?

Download the font files when the .swf launches, and download the language file when the user selects a new language.

adam
A: 

Yes, the languages are downloaded from the server when the user changes the language, but not the font.

My concern is, if I have to download an asian font different from Myriad, how can say to flash, hey my "Default Font" is now this asian font. And if i have to display the language names, how can I display the asian names, without changing the list style...

It's not easy.

+1  A: 

You could include a property for fontWeight=bold or fontWeight=normal in your localized property files. Then you could use setStyle() to change the applications. An example from the previous link:

StyleManager.getStyleDeclaration("Button").
            setStyle("color","Blue");

which could be:

        StyleManager.getStyleDeclaration("DefaultFont").
                    setStyle("fontWeight",
resourceManager.getString('locale_properties', 'fontWeight'));

This is not exactly correct example but I hope it points you in the right direction.

Another approach would be to dynamically load a new style sheet: http://stackoverflow.com/questions/204924/how-do-you-dynamically-load-a-css-file-into-a-flex-application

Brandon