Flash about font components and character embedding functions

Source: Internet
Author: User
Tags file size final reference valid advantage
Detailed ======== on the article ========

One of the advantages of Flash is the ability to use a variety of fonts, while traditional HTML uses a variety of non-system default fonts only two ways

1, is to embed special fonts in the browser, but this feature is not only large size and not for all browsers are applicable. (English fonts only hundred K but Chinese fonts are at least 1M above) Such a method is obviously unrealistic for Chinese.
2, is the use of special fonts in the place to make pictures, the advantage is that any platform browser display results are consistent. But the disadvantage is also obvious, the first modification is not easy, even the most subtle changes need to use a special graphics editing software to modify, is very troublesome. And it's not possible to use too many fonts, so the picture will be extremely large and even larger than the size needed to embed the font.

Flash does not have any of the above problems, when you enter any font (including system fonts) in the export of SwF format will be automatically converted to graphics, that is, on any platform display effect is the same, regardless of his installation does not install this font. And it's as easy as modifying any text document. As the number of words increases, the final SWF file will be larger. But this increase is nothing compared to the size of the number of m needed to nest fonts in HTML. And it has nothing to do with platform and monitor.

However, the characteristics and advantages of flash is small, add a word to increase the size of hundreds of bytes, which is also unbearable for Flash. So flash provides more functionality to make the SWF file smaller. Below I will detail flash about font components and character embedding functions such as the advantages, disadvantages and scope of application.

First of all, Flash in the "Use Device Font" function, this feature in the text properties. Only valid for static text, previously said, any text entered will be automatically converted to the image of Flash, the advantage is any platform any browser display effect is consistent, the disadvantage is that each additional word will increase the size of the final SWF file. If you enter a paragraph of text, then select the device font in the attribute. Flash will not convert the font you entered into graphics, so no matter how many words you write will not affect the size of the SWF. But when someone opens the SWF file, it first checks to see if the system has the fonts you typed, and if so, displays the fonts you entered. This looks just like the way you edit on the local machine. But once the viewer's machine does not have the fonts you entered, the SWF will display the default font on the system used by the viewer, as for the effect ... Resign yourself to it. This approach is suitable for fonts that are normally available in the viewer's system, even if the viewer does not have the font to display the word. But the effect is unpredictable.

Now talk about character embedding in dynamic text, which is the function of setting text to dynamic text or entering text with character embedding. The function of this feature is to load the selected characters into the SWF file, so that the dynamic character alphanumeric is loaded into or typed into the font you originally embedded. For example, you entered a sentence with a simplified bold text, point its properties select the embedded character, select the specified range there are many languages, select the type of language you type--here is Simplified Chinese, click OK. This is equivalent to you put the whole set of simplified bold embedded in the Flash file, when loading dynamic text when this place is displayed in bold. This will make the final SWF file 1M more (the specific size of the font based on the size of the decision, so English is certainly much smaller than Chinese). The fonts that are nested in the test are as valid as static text. For example, this is embedded in the simplified bold, so you enter a large number of static simplified black body after the SWF file added only hundreds of bytes. (You do not need to select a device font)

If you enter a simplified but choose to embed the traditional, then the traditional characters are not the same as simplified writing will not be shown, only the more simplified writing consistent with the traditional will be shown. An inline character also has an option that is automatically populated. He will automatically embed the words you write, embedding only these words, so that the final file size will be much smaller. The disadvantage of doing so is that for example, you entered the original is "You are stupid", and then choose to automatically fill the left side of the automatic fill will show "You are Stupid", of course, here you can add or delete text, such as delete "idiot" so that is left "you are", the last choice to determine. This allows you to embed only two characters in Flash. The "You are Stupid" you created will only show "you Are" and no other character will show. If you are entering text and can only enter "You are", it is not valid to enter other characters.

Next, the font components, the use of font components is to press F11 open the library, the left mouse button point library filename to the right side of the buttons, there will be a menu, select New Font. This will pop up a font of the property box, to set. Name to make a meaningful name do not have the name of the font, such as "title text." And then the font you're going to use, here's the sawtooth option (mentioned below). You can see a font with a new font name called the name in the font selection. Because we started to build the font symbol name is called title text, so here is called "title text *" Choose to use this font, you can use two ways to make good use of this feature.

======== Medium ========

1 directly in the Flash file, this does not affect the size of the Flash file, just like ordinary flash files, flash default will convert fonts to graphics, you can also set the system font. As usual, the only difference is that when you change fonts, you can change the font components directly. For example, all of your text is originally XXFarEastFont-Arial, but later felt better to look in bold, you can directly change the properties of the font components (the change is to open the library, select the font component point right mouse button, select attributes) from the song modified into bold. This way all text that uses font elements is changed to bold (think about how painful it would be if you didn't use this feature).

2 The first step is the same as the method one, all finished, select the font components, select the link. (Open the library, select the font component point right mouse button, select link) Select the "For Runtime share import" URL you will use a SWF file path that uses a relative or absolute path (if you can write the font. swf) identifier in the same folder, use the name of the font symbol directly.

The second step, like method One, is simply to create a SWF file with only font components. Select the link (open the library, select the font components click the right mouse button, select the link), select the "Run-time shared export" URL to fill in the previous step of the path to write well. (the font. swf) identifier is also consistent with the font symbol name in the previous step. It is then exported as a SWF file. You will find that the file is larger (if you chose the sawtooth text will increase the size of the SWF font library file (in the case of the use of sawtooth see this blog related articles)). But the big point is nothing, this is just a reference to the file, it is as if the font is placed in this face when the method of the establishment of the document when necessary to find from here. In this case, what to take, the method of the establishment of the file size will be very small, incredibly small. Haha good things. And like the first set of files that want to change the font or something, you just have to change method two. The font component attribute of the file created. This is like the first step the SWF file was created as a shortcut to the SWF file created in the second step. Just the second step to build the SWF file reference, the actual things are in the second step of the SWF file set up.

======== Next Chapter ========

The font components in Flash can refer to multiple in a SWF. That means you can use a variety of font components in your SWF work to refer to different font component packages outside. However, in a "referenced" SwF font file package, only one font can be stored and packaged. Otherwise there will be an error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.