views:

1770

answers:

2

hey!

I have a problem with doing proper font embedding in a actionscript 3 project (flash CS4, not flex).

I followed this Adobe guide to do font embedding: http://www.adobe.com/devnet/flash/quickstart/embedding%5Ffonts/

the guide tells to set the Textfield.embedFonts property to true. if I do so and try to display a text with another font in this textfield, then nothing is displayed - that's fine, i expect it like this.

But now I have this particular problem:

i embed the font "Arial" in Regular style and create two input Textfields on the stage. one of them i set the embedFonts property to true (as described in the guide) the other i leave as is. Now I publish the thing as swf and try to enter the following (Turkish) string into the textfield

Yeni Yılın Barış ve Mutluluk Getirmesini Dileriz.

now the problem is, that the untouched textfield displays the string correctly - but the one with embedFonts set to true is missing some of the letters (for example ş is not displayed). But the Arial font does have this letter since it is displayed correctly in static - so why does it not render correctly when i set this property (as told in the guide)?

in my final app there shall be a single textField, but multiple embedded fonts and a way to switch between them (for example the user must be able to choose another font for entering chinese text).

can someone tell me how to do it properly?

thanks!

A: 

Embedding fonts in Flash is not as straight forward as it should be, and there are a bunch of special cases... One way to ensure that you are embedding the correct characters of your font is enabling "Generate size report" in the Flash Publish Settings.... there you will see all characters of all fonts that are being embedded. The only exception is that fonts embedded using the [EMBED tag do not show there.

Adding the font to the library doesn't embed the whole set of characters of that font (Arial for instance is about 8mb)... it only embeds a subset of them... I'm not sure if its always the standard occidental Latin set, or if it depends on the computer language. You can extend this set manually using any textfield in your movie (with the "Character embedding..." dialog) as long as you use the actual Library Font name (it shows in the font list with an asterisc at the end... in your case it would be "Arial*").

You can also use the [EMBED tag with the unicodeRange to declare de character set, but bare in mind that the fonts you declare there wont be available in the Flash IDE during editing time... you need to set them at runtime with ActionScript (TextFormat, StyleSheet, etc...), which is not very practical when working with Flash.

Cay
hi and thanks for your answer!the strange thing is, even if I create a textfield and enter the stringYeni Yılın Barış ve Mutluluk Getirmesini Dileriz.in the authoring environment and then export, the text will behave like this:-if i set character embedding for this textfield to "don't embed":the text looks alright-if i set character embedding for this textfield to "All"some of the letters are not displayedeven if I paste the string into the "embed these characters" field, the string won't display properly after exportthank you for the help
genesys
A: 

I use the system fonts, and avoid the embedded ones like Arial.

  public function get availableFonts(): Array
  {
     var font: Font = null;
     var allFonts: Array = Font.enumerateFonts(true).sortOn("fontName", Array.CASEINSENSITIVE);
     var embeddedFonts: Array = Font.enumerateFonts(false);

     var excludeList: Object = {}
     for each(font in embeddedFonts)
     {
        excludeList[font.fontName] = '';
     }

     var ourFonts: Array = [];
     for each(font in allFonts)
     {
        if (!excludeList.hasOwnProperty(font.fontName))
        {
           ourFonts.push(font);
        }
     }

     return ourFonts;
  }

The list of fonts that this returns are going to have all their letters.

(wouldn't it be nice if ActionScript had some easier way of doing set difference built in?)

Jim Carroll