0

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

Christopher Grigg
  • 2,238
  • 27
  • 33

3 Answers3

2

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.

Corey
  • 5,818
  • 2
  • 24
  • 37
  • +1 because languages like asian have soooo many character you would have to embed like 6-7MB for one font (you need to embed bold or italic ones extra => ±20MB). use system fonts for asian and embed fonts only for latin-based languages. – Philipp Kyeck Jul 18 '11 at 16:09
  • This only works if your design team lets you. I think if I declared that an asian translation had to use system fonts I'd be tarred and feathered! – shanethehat Jul 18 '11 at 16:14
  • Agreed this is the same approach we used at webkinz.com when we were translating to 14 diff languages. Also note that you can use the new TLFTextField and it displays such languages much better and also allows you to apply styling to system fonts, which makes for a nicer presentation all-round. –  Jul 18 '11 at 16:14
  • This works well if you use TextFormat to set your font depending on the location. This way, you can have a specialty font that has the characters required and a fallback for special characters. Any design team will be hard-pressed to find a specialty type-face with Cyrillic, Thai, Mandarin, Japanese and Greek characters (just to name a few). – Corey Jul 18 '11 at 16:38
  • Great comments thanks! This inspired me to try the TextLayout component which seems to work well, using Arial as its default font. The embedded fonts where implemented in the old version of this app (as2) for a reason, so not sure if I can get away with just Arial or _sans. – Christopher Grigg Jul 18 '11 at 17:13
2

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 ) );
Community
  • 1
  • 1
Jevgenij Dmitrijev
  • 2,228
  • 1
  • 15
  • 23
1

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

shanethehat
  • 15,460
  • 11
  • 57
  • 87