While there are ways to load fonts as swf files, what I am more looking at is a way to load the font file itself, say the user uploads a font file , how can i use that font file in the application itself?
Thanks, Faisal Abid
While there are ways to load fonts as swf files, what I am more looking at is a way to load the font file itself, say the user uploads a font file , how can i use that font file in the application itself?
Thanks, Faisal Abid
Unfortunately I am quite sure this is not possible, in any normal way at least. You can't load in a bytearray of a ttf-file and pass it to Font.registerFont(), which needs to be called in order to use the font.
However, even though I do not possess all of the knowledge to do it, I know it is definitely not impossible.
As you said, fonts can be loaded from swf's, and swf's can be created dynamically as a byteArray and loaded in.
I don't know if this would be an option at all for you, and I'm not sure how hard it would really be. I would read up on the swf file format spec available here: http://www.adobe.com/devnet/swf/ Then study the bytecode of an empty swf, and then the bytecode of a swf with a single font embedded, and find where the data of the font is, that's what has to be replaced with the font supplied by the user. I wonder if all of the file-content is untouched when embedded in the swf. In that case it's practically just a matter of inserting the font-data in the right place of the template swf, which shouldn't be too hard. But it probably be a bit harder than that, and I suspect it gets compressed as well... There might be some info about creating swf's programmatically if you google around..
Sorry I couldn't give you a more convenient answer =)