openlaszlo seba.wagner on 24 Jan 2007 03:16 am
OpenLaszlo dynamic Font Libraries
I have been searching for hours to find some hack to make it happen to create a text-component in OpenLaszlo which uses a dynamic loaded Font. Finally I found a way. People might get weired if they hear that but its really horrible problem (for example in a RTE) if you have to load 100 Fonts on startup of a APplication cause that can be tons of data never used. Basically the native Flash IDE does not really give you possibility to load a FOnt dynamic… they have somethign called *shared Library* which handling is a mess!
My way is too create a Font-Library using swfmill
-> For example if you got an Font called *accid__.ttf* you write following XML for swfmill:
http://www.laszlo-forum.de:8080/lps-latest/laszlo_forum/dynamicfont/accid.xml
compile it with: swfmill simple accid.xml accid.swf
(keep an eye on the *import* statement in the xml.. it has to be a valid url to the swf, otherwise it will not work!)
In the OpenLaszlo App load the SWFFont using some ugly ActionSCript
_root.createEmptyMovieClip(”meinMC”,220);
_root.meinMC.loadMovie(”accid.swf”,_root.meinMC);
And then i attach this Font by its name *accid* directly to the TextField in OL.
Klick on a Button to create a new TextBox with the dynamically loaded Font:
http://www.laszlo-forum.de:8080/lps-latest/laszlo_forum/dynamicfont/loadfontsdynamic.lzx.swf
Unfortunatly i cannot attach this Font to the FontManager, i think thats why some of the attribute’s of the
Text-Component like *resize* do not work any more.