View comments | RSS feed

Creating custom character sets

In addition to using the Flash default character sets, you can also create your own character sets and add them to the Character Embedding dialog box. For example, you might need to allow some fields to include Extended Latin, to support various accented characters. However, perhaps you don't need the numerals and punctuation, or perhaps you only need uppercase characters. Rather than embedding entire character sets, you can create a custom character set that contains only the characters that you need. This way you can keep the size of your SWF file as small as possible, because you don't store any extra font information for the characters that you don't need.

To create a custom character set, you must edit the UnicodeTable.xml file, located in the C:\Program Files\Adobe\Adobe Flash CS3\<language>\First Run\FontEmbedding\ directory. This file defines the default character sets and the character ranges and characters that they contain.

Before you create a custom character set, you should understand the necessary XML structure. The following XML nodes define the Uppercase [A..Z] character set:

<glyphRange name="Uppercase [A..Z] " id="1" >
    <range min="0x0020" max ="0x0020" />
    <range min="0x0041" max ="0x005A" />
</glyphRange>

Notice that the glyphRange node includes name, Uppercase [A..Z], and id. A glyphRange node can have as many range child nodes as you need. A range can be a single character, such as 0x0020 (the space character), seen in the previous snippet, or a range of characters, such as the second range child node. To embed only a single character, set the min value and the max value to the same unicode character value.

Another example of an XML glyphRange node is the Numerals [0..9] node:

<glyphRange name="Numerals [0..9] " id="3" >
    <range min="0x0030" max ="0x0039" />
    <range min="0x002E" max ="0x002E" />
</glyphRange>

This range of characters includes the Unicode values 0x0030 (zero) through 0x0039 (9), as well as 0x002E (.).

Before you create a custom character set, you need to know the characters and their corresponding Unicode values. The best place to find Unicode values is the Unicode Standards web site, www.unicode.org, which contains the Unicode Character Code chart for dozens of languages.

CAUTION

 

To add custom character sets, you need to edit an XML file in the Flash installation folder. Before you edit this file, you should make a backup copy in case you want to revert to the original Unicode table.

CAUTION

 

Adobe recommends that you do not modify the existing character sets that are installed with Flash, and that you instead make your own custom character sets that include the characters and punctuation that you require.

To create and use a custom character set:

  1. Open the UnicodeTable.xml document, located in the <Flash install directory>\<language>\First Run\FontEmbedding\ directory, using an XML or text editor such as Notepad or TextEdit.

    NOTE

     

    Remember to save a backup of this document, in case you want to revert to the original file that is installed with Flash.

  2. Scroll to the bottom of the XML document and add the following XML code directly before the closing </fontEmbeddingTable> node:
    <glyphRange name="Uppercase and Numerals [A..Z,0..9] " id="100" >
        <range min="0x0020" max ="0x0020" />
        <range min="0x002E" max ="0x002E" />
        <range min="0x0030" max ="0x0039" />
        <range min="0x0041" max ="0x005A" />
    </glyphRange>
    
  3. Save your changes to UnicodeTable.xml.

    If you have Flash open, you must restart the application before you can use the new character set.

  4. Open or restart Flash and then create a new Flash document.
  5. Add a new TextField instance on the Stage by using the Text tool.
  6. Set the Text type of the TextField to Dynamic in the Property inspector, and then click Embed Character Options to open the Character Embedding dialog box.
  7. Scroll to the bottom of the Character Embedding dialog box and select your new custom character set, Uppercase and Numerals [A..Z,0..9] (38 glyphs).
  8. Select any other character sets and click OK.

    If you select your custom character set, Uppercase and Numerals [A..Z,0..9], as well as the default Uppercase [A..Z] or Numerals [0..9] character set, notice that the number of glyphs that are embedded doesn't change. This is because all of the uppercase characters are included in your custom character set, and Flash doesn't include duplicate characters, which keeps the file size as small as possible. If you select the Punctuation character set, which includes 52 glyphs, as well as your custom character set, which includes 38 glyphs, Flash stores information for only 88 glyphs instead of 90. This happens because two overlapping characters, the space and the period, are already included in your custom character set.

    TIP

     

    The position of a character set in the Character Embedding dialog box is determined by its location in the XML document. You can reorder the character sets, including your custom character sets, by moving <glyphRange> packets in the XML file.


Flash CS3


Comments


No screen name said on May 17, 2007 at 2:48 PM :
Very useful information.
Anyway, if you'd like this thing to work (WinXP), edit the UnicodeTable.xml file that is in C:\Documents and Settings\<username>ocal settings\application data\adobe\flash cs3\<language>\configuration\fontembedding\
it will save you some time :)
no screen name said on aug 9, 2007 at 1:48 am :
there is a nice unicode table generator tool available on the address:
http://www.epic.dk/flash-unicodetable/flash-unicodetable-generator.php

 

rss feed | send me an e-mail when comments are added to this page | comment report

current page: http://livedocs.adobe.com/flash/9.0/main/00000894.html