views:

374

answers:

3

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.

A: 

At the very least someone wishing to swap fonts will need to open an .fla, say "FontsLibrary.fla", and embed the font there. If this is acceptable, I can expound upon how you would actually use the font from the loaded FontsLibrary.swf.

sberry2A
i know how to do this and have used this in the past. however i'm trying to create a easily update-able component that can be amended via xml. there are so many sifr font files out there already i was hoping there might be an equivalent for basic fonts.
Josh
+1  A: 

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 {}
maxmc
+1  A: 

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

George Profenza
how would i (can i) use sIFR fonts in my own project? how would i generate an embedded font file dynamically? alternatives won't help me for this project that I am building in Flash.
Josh
you would use sIFR as you would normally. If you were to use Ştefan's sIFR ready swfs, you would probably need to allow users to select one of the fonts available(as opposed to them uploading and using a font). Otherwise you would have to allow the users to upload a custom font your server, your would create an .as file using PHP(using the Embed meta like maxmc suggested), send that to the Flex Module to compile a swf that you can use with sIFR.
George Profenza