flashgameblog.at

12.06.2010
17:10

Flash's font hell 2 - embedding a font

 

This time we will learn how we can embed a font into the swf file.

Last time we have heard the way how we embed the font depends on what tool we use to create the swf and what we want to do with the text field.

Flash IDE

 

In the flash IDE we have two ways to embed a font:

Text field properties

 

The easiest way to embed a font is to use the embed button in the text field's properties. This allows you to select exactly the characters you need.

pros:

* Holds the swf file as small as possible because just the needed characters can be embedded.

 

cons:

* There can just be one font linked to a text field. So it's not possible to combine different fonts or font variations like regular, bold or italic in one text field.

 

Embedding a font in the library.


A more flexible way to embed a font into the swf file is to put it into the library. This way we can link the font to a text field at runtime and so it allows us to use different fonts on the same text field. (If we use the text property we can just use one font at a time. To combine different fonts at the same time we have to use the htmlText property. More about it later.)

Don’t forget to activate the "export for actionscript" checkbox in the library's font entry. The linkage name is not important, we don’t need it. But it has to be activated to make flash putting the font into the swf file.

pros:

* Fonts are more flexible to use.


cons:

 * If we put a font into the library, flash embeds all characters and we don’t have a chance to embed just some of them. This leads to bigger file size of the swf file.

 

Flex

 

In flex we just have one way how we can embed a font into a swf file. It’s the equivalent version of the second method in the Flash IDE. But here we can select characters to keep file size low.

Here is an example how it might look:

  1. ...
  2. [Embed(source='C:/WINDOWS/Fonts/ARIAL.TTF', fontName='_Arial', unicodeRange='U+0020-U+002F,U+0030-U+0039')]
  3. public static var _Arial:Class;
  4. ...


More about the embed metatag:
http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html


That' it for today!

We have now the font embedded in the swf file. The next time we will see how we use this font in a text field.

< < June 2010 > >
S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Blog rolls

Latest Comments

Blur Filter
17.01.2011 11:01
ISO FTW!
18.09.2010 20:17
ISO Blender Camera Setup
24.04.2010 06:58
update
21.03.2010 01:15

Archive

  • [-]2010(9)
    • [-]November(1)
    • [-]August(1)
    • [-]July(1)
    • [-]June(2)
    • [-]April(1)
    • [-]March(2)
    • [-]February(1)
  • [-]2009(13)
    • [-]December(4)
    • [-]November(8)
    • [-]October(1)

Copy and paste this link into your RSS news reader

RSS 0.91Posts
RSS 2.0Posts

Social Bookmarking

Bookmark bei: Mr. Wong Bookmark bei: Webnews Bookmark bei: Icio Bookmark bei: Oneview Bookmark bei: Linkarena Bookmark bei: Favoriten Bookmark bei: Seekxl Bookmark bei: Favit Bookmark bei: Social Bookmarking Tool Bookmark bei: Power Oldie Bookmark bei: Bookmarks.cc Bookmark bei: Newskick Bookmark bei: Newsider Bookmark bei: Linksilo Bookmark bei: Readster Bookmark bei: Folkd Bookmark bei: Yigg Bookmark bei: Digg Bookmark bei: Del.icio.us Bookmark bei: Reddit Bookmark bei: Simpy Bookmark bei: StumbleUpon Bookmark bei: Slashdot Bookmark bei: Netscape Bookmark bei: Furl Bookmark bei: Yahoo Bookmark bei: Spurl Bookmark bei: Google Bookmark bei: Blinklist Bookmark bei: Blogmarks Bookmark bei: Diigo Bookmark bei: Technorati Bookmark bei: Newsvine Bookmark bei: Blinkbits Bookmark bei: Ma.Gnolia Bookmark bei: Smarking Bookmark bei: Netvouz Information