Here is some sample code we used to create a font swf with unique
unicode ranges. Worked pretty well. Also side note, if you change your
unicode range, you have to clean your fonts eclipse/flex builder
project or it won't compile with the updated range. Then you could
compile this to a swf and load that swf into your application.

package
{
        import flash.display.Sprite;

        public class _Arial_de extends Sprite
        {
                [Embed( source='fonts/arial.ttf',
                                fontName='_Arial_de',
                                
unicodeRange='U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+0020,U+00A1-U+00FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183'
)]
                public static var _Arial_de : Class
        }
}

On Tue, Nov 25, 2008 at 11:20 AM, Glen Pike <[EMAIL PROTECTED]> wrote:
> Hi,
>
>   I re-read your email again and noticed you want runtime font rather than
> embedded in your final application...
>
>   The Troyworks article talks about embedding fonts into a separate SWF,
> then loading these into your main SWF at runtime...
>
>   I guess you are using Flex to create pure ActionScript projects, so for
> the Troy Works sample, you would need to create 2 ActionScript projects -
> one for compiling the "FontLibs.swf" example - you probably want to rename
> the output to a sensible font name - like MyriadProFontLib.swf - then your
> second project is your main application / the second block of code, which
> needs to load the swf from the first.  You should not need any MXML to get
> it to compile - just adapt the code for your normal way of developing here.
>
>   If you are on a PC, it is worth checking out FlashDevelop because it's
> really nice for coding and set up to produce projects like this.  It lets
> you do MXML or ActionScript based projects - Flex Builder just gives you the
> WYSIWYG editor (plus a few more things like profiling, etc).  Either way,
> both Flex Builder and FlashDevelop use mxmlc - the compiler - to output your
> SWF and this is what lets you do the [Embed], unlike the Flash IDE which did
> not allow Embed.
>
>   There are quite a few articles on Runtime Font embedding and managers with
> Flash - it seems to be a bit of a black art to get everything running
> smoothly and I am only part way there.  Look on the Devnet site and in the
> Flex doc's online - there are some useful examples there.
>
>   Sorry if I caused any confusion here..
>
>   Glen
>
> Glen Pike wrote:
>>
>> Hi,
>>
>>  You can use the [Embed] Directive in a few places in Flex.
>>
>>  Inside your MXML code - create a new project - then you can add normal
>> actionscript by inserting
>>
>>  <mx:Script> tags - start typing "Scr..." and Flex Builder will try to
>> auto-complete.
>>
>>   Between your Script tags is ActionScript - same way as you would write
>> it anywhere else.
>>
>>   You can also create ActionScript only components as part of your project
>> and write your code as AS.
>>
>>   You can also embed your fonts in style sheets, which just contain fancy
>> CSS declarations.  I have an example at home, so will post it this evening
>> if you don't get sorted - in about 3hours from now.
>>
>>  Keith Peters also wrote an article about Embed on his blog - a while back
>> so you might have to search for it
>>
>>  Glen
>>
>> Mike Grunwald wrote:
>>>
>>> I've been searching for the best way to handle fonts when localizing
>>> Flash applications. Ideally I'm looking for a way that I can create SWFs
>>> that have specific character ranges of specific fonts embedded in them that
>>> I can load in to my applications as needed based on the language that has
>>> been selected by the user.
>>>
>>> I've come across many posts of people describing this approach, most
>>> notably:
>>>
>>>
>>> http://troyworks.com/blog/2008/09/12/flash-runtime-font-sharing-embedding-with-only-partial-character-sets-how-to/
>>>
>>> The problem for me is I don't know Flex at all. I have Flex Builder 3 and
>>> use it almost everyday as my primary AS3 editor, but I don't know the first
>>> thing about MXML or even creating Flex projects. The previous post above
>>> describes this technique using FlashDevelop and the Flex SDK. Since I have
>>> Flex builder I'm just looking for a little guidance as to how to get similar
>>> code to compile a SWF in Flex Builder.
>>>
>>> Any help would be greatly appreciated. Or if any or you have any better
>>> methods of how to handle this that you would like to pass on, I'm totally
>>> open to suggestion.
>>>
>>> Thank in advance,
>>> _mike
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>
> --
>
> Glen Pike
> 01326 218440
> www.glenpike.co.uk <http://www.glenpike.co.uk>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Kris Range
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to