Christopher Grigg
Christopher Grigg

Reputation: 2308

Alternative to embedding a font in as3

I have quite a basic question to ensure I am not missing something obvious!

Does anyone know of an alternative to embedding fonts? I am developing a global app which will change the font for Asian languages. If these fonts are embedded it will result in a massive SWF file, I would like to get the font, when it goes on the Asian system from the windows/fonts folder.

Cheers

Upvotes: 0

Views: 2178

Answers (3)

Jevgenij Dmitrijev
Jevgenij Dmitrijev

Reputation: 2238

You can do this by embeding the font in external SWF files.

for example you have:

Arial_EN.swf

Arial_RU.swf

Arial_JP.swf

Arial_DE.swf

Then in your configuration file you a defining which swf to load. After you load SWF

<!-- english Arial -->
<o n="font">
<o n="path">swf/Arial_DE.swf</o>
    <!-- Styles, under which names your fonts are exported while emebeded -->

    <o n="style">bold</o>
    <o n="style">bold_italic</o>
    <o n="style">italic</o>
    <o n="style">regular</o>
</o>

In your library you should see somehting like this:

Load the swf:

var fontLoader:Loader = new Loader ();
//all the eventlistener and functions for it
fontLoader.load ( xml.font.path )`

After you load the swf and you have the style names just register the font, if you will be using embedFonts=true option

Font.registerFont ( fontLoader.getClass ( xml.font.style ) );

Upvotes: 2

Corey
Corey

Reputation: 5818

I have had success with using system fonts such as Arial or simply _sans for languages that have special characters. Just make sure to set embedFonts to false.

Upvotes: 2

shanethehat
shanethehat

Reputation: 15570

You can embed the different fonts that you will require in different swf asset files and only load in the required fonts at runtime.

Upvotes: 1

Related Questions