Josh
Josh

Reputation: 6322

embed fonts in as3 from resource file

I'm creating a generic flash navigation. I'd like to allow people to use their own fonts like sIFR. I know i can just create a swf file with a font embedded but i'd like to make it as easy as possible for someone to swap fonts so an existing method of creating a swf font file would be preferred.

Upvotes: 1

Views: 1046

Answers (2)

George Profenza
George Profenza

Reputation: 51837

Don't know if it helps, but Ştefan Isarie has quite a few sIFR fonts ready for use.

Maxmc's suggestion looks fine. Would you be able to generate the swf on the server via the Flex Module for Apache/IIS ?

Hopefully you won't get in trouble with special characters.

Also, just as a backup plan, have you considered alternatives ?

HTH, George

Upvotes: 1

maxmc
maxmc

Reputation: 4216

You could define the font swfs in a xml file, <font id="Futura" src="fonts/futura.swf" /> then load the xml at runtime, load the defined font.swf and use Font.registerFont with the the loaded swf.

Note that you can't easily load original font formates like ttf. (which would be to big anyway) You need to complile them to swf in order to be able to load and register them in your application.

[Embed(source = 'fonts/futura.ttf', fontName = 'Futura')]
public class Futura extends Font {}

Upvotes: 1

Related Questions