Thanks Glen.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Glen Pike
Sent: maandag 12 april 2010 15:25
To: Flash Coders List
Subject: Re: [Flashcoders] AS30 - Embedding Fonts question

Hi,

    Not possible in CS3 IDE, but you can build "font" files in Flash 
Develop or using Flex.

    See the example below - if you can use Flash Develop you can set up 
a "Pure AS3 project" and use something like the code below:

    The only caveat with this is the fontName property - you can't use 
the same name as the system font because you might get clashes when you 
load both.
   
    If you want to find ranges in Unicode, paste your chars into here to 
find out ranges - some of the ones in the Adobe file are wrong.
   
    http://www.zenoplex.jp/tools/unicoderange_generator.html
   
    Hope this helps.

    Glen

package {
    import flash.display.Sprite
    import flash.text.Font;
    /**
     * Times font embedding class example.
     *
     * This is different to embedding fonts with Flash because you can:
     *
     * 1.  Set the unicodeRange - specify certain characters / ranges to 
embed, reducing file size.
     * 2.  Choose your own fontName to avoid "font clashes" at runtime.
     * 3.  Register the font in the file - the contstructor is called as 
the swf is loaded because this class is the
     * document class, so all you need to do is look for your font by 
fontName in your app.
     *
     * NB - Adobe's UnicodeTable.xml file was used to get the ranges for 
unicode, which omit the ? and a few other chars, so
     * this was doctored to include those (basically 
U+0300-U+030A,U+0041-U+005A was combined into U+0030-U+005A.
     *
     * @author Glen
     */
    public class _Times extends Sprite {
        //Basic Latin characters + some punctuation - don't use the 
Adobe UnicodeTable for Basic Latin - it misses  "?" = 0x030F
        [Embed(source = "C:/WINDOWS/Fonts/TIMES.TTF", fontName = 
"_Times", fontFamily = "Times", mimeType = "application/x-font-truetype",
        unicodeRange = 
'U+0020-U+002F,U+0030-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E')]
        public static var _font:Class;

        public function _Times():void {
            trace("Font Loaded:: _Times");
            Font.registerFont(_font);
        }
    }
}
Cor wrote:
> Hi List,
>
>
> In Flash CS3 - AS30: Is it possible to embed fonts through a class file
> only?
>
> Thus, not from the library, but the "MyFont.ttf" directly, like other
> external data?
>
> Regards
> Cor
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>   

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG - www.avg.com 
Versie: 9.0.801 / Virusdatabase: 271.1.1/2803 - datum van uitgifte: 04/12/10
08:32:00

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to