[swfmill] How to reference an embedded font in AS?

Gregor Frey gregor.karl.frey at t-online.de
Thu Sep 29 02:41:30 PDT 2005


Hi,
what is the right way to declare a font in the swfmill-xml and refer to 
it in action script?

My xml looks like the following:
        <library>
            <font id="vera" name="vera" import="Vera.ttf" bold="false"/>
            <font id="vera_bold" name="vera" import="VeraBd.ttf" 
bold="true"/>
            <clip id="Application" class="Application" />
            <clip id="MoveableTextField" class="MoveableTextField"  />
        </library>

Inside my Application class I
- create a TextField by calling the MovieClips "createTextField"
- set the "embedFonts" attribute of the TextField to true
- create a new TextFormat and assign it to the TextField
- assign a string to the text attribute of the TextField

But the running application doesn't show the text. The text fields 
remain empty.

Questions:
1. Is the glyphs atttribute required for the font tag? In my case the 
swf-files are bigger if I remove the explicit glyphs. Thus I expect that 
without an explicit glyph setting all characters are imported, right?
2. How does the string look like, by which I refer to the imported font? 
I tried the following:
- textFormat.font = "vera(Vera.ttf)";
- textFormat.font = "Bitstream Vera Sans";
- textFormat.font = "vera";
The result was always the same, the text was not displayed.

Could anyone please give me an example how embeded fonts are used in 
actionscript, or point out, what is wrong with my procedure?

Ciao
Gregor




More information about the swfmill mailing list