[Laszlo-dev] Loading Fonts dynamic (Flash-runtime)

Henry Minsky henry.minsky at gmail.com
Mon Jan 29 08:14:12 PST 2007


Hmm, the library file produced by swfmill seems to just have put a
"importAssets" swf instruction at the end of it, which references the
library file itself (by it's URL).

I don't think I ever tried that when I was experimenting with the
importAssets tag in the LPS; I tried putting it in the main app, which did
sort of work but forced the library to get loaded at the same time as the
main app was being loaded.

I never thought to put the importAssets tag in the library, because I guess
I figured it would load the assets into the child movieclip, and they still
wouldn't be usable from the root movieclip. I'll play with this and see if I
can get dynamically loaded resources to be attachable to views in the main
app.

On 1/29/07, Henry Minsky <henry.minsky at gmail.com> wrote:
>
> OK I will take a look at integrating this, and try to figure out what swf
> byte code is being used in the library.
>
>
> On 1/28/07, Sebastian Wagner < seba.wagner at gmail.com> wrote:
> >
> > hi,
> >
> > I have added some methods to LzFontManager but I would suggest to
> > include such librarys in a more general way sothat other sharedLibrary's
> > with images can be included and attached to loaded Library too.
> >
> > see attached i have tested it with legals:
> > Files changed:
> > $LPS_HOME/WEB-INF/lps/lfc/kernel/swf/Library.lzs
> > $LPS_HOME/WEB-INF/lps/lfc/kernel/swf/LzFontManager.as
> > $LPS_HOME/WEB-INF/lps/lfc/kernel/swf/LzDynamicLibraryLoader.as
> >
> > Test-Files:
> > $LPS_HOME/test/dynamiclibrary/*
> > $LPS_HOME/test/dynamiclibrary/fonts/*
> >
> > in the test-file (http://localhost:8080/legals/test/dynamiclibrary/loadfontslibrary.lzx )
> > it includes one font by native font control and the second one has to be
> > loaded at runtime before creation of an textbox otherwise Debugger throws a
> > *WARNING: Undefined font 'KentuckyFriedChickenFont'*
> >
> > note:
> > 1.) The FontLibrary-swfs have as import url "http://localhost:8080/legals/test/dynamiclibrary/fonts/KentuckyFriedChickenFont.swf
> > " so they have to be placed really there, and it will only work from
> > localhost
> > 2.) the swf's are created using swfmill. Next thing to make it really
> > working without third-party-tools is to make lzx-library-files which are
> > compiled as *sharedLibrary*. I have no clue how the bytecode of an swf must
> > be changed to make it a sharedLibrary. Having a look a swfmill might help it
> > is not that much src-code.
> >
> >
> > sebastian
> >
> > 2007/1/25, Max Carlson <max at openlaszlo.org>:
> > >
> > > Hi Sebastian,
> > >
> > > You should be able to add the font at runtime with
> > > LzFontManager.addFont(...).  Have you looked at the LFC source?  The
> > > relevant file is here:
> > >
> > >
> > > http://svn.openlaszlo.org/openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzFontManager.as
> > >
> > > Here's the method signature:
> > >   /*
> > >    * Creates an <b><i>LzFont</i></b> with the given parameters and
> > > adds
> > > it to
> > >    * the <i>font</i> list.
> > >    *
> > >    * @param fontname: The name of the font. This is the string that
> > > will
> > > be used
> > >    * when requesting a font via <b>getFont</b>
> > >    * @param Object n: The plain style of the font.
> > >    * @param Object b: The bold style of the font.
> > >    * @param Object i: The italic style of the font.
> > >    * @param Object bi: The bold italic style of the font.
> > >    * @access private
> > >    */
> > > LzFontManager.addFont = function (  fontname , n , b , i , bi ) { ...
> > > }
> > >
> > > I'd love to see runtime font loading built into the platform.  It
> > > should
> > > be possible to patch LzFontManager to add a method that accepts an url
> > > and does the the _root movieclip funny business, and calls
> > > addFont.  If
> > > you can get a patch working we can submit it for legals!
> > >
> > > Great work so far - let me know if there's anything I can help with.
> > > Keep hacking!
> > >
> > > --
> > > Regards,
> > > Max Carlson
> > > OpenLaszlo.org
> > >
> > > Sebastian Wagner wrote:
> > > > hi,
> > > >
> > > > I have found a way to load a Fonts dynamic and attach them to a
> > > > OL-TextField
> > > > in Flash runtime.
> > > >
> > > >
> > > http://wagner-sebastian.com/wordpress/2007/01/24/openlaszlo-dynamic-font-libraries/
> > > >
> > > >
> > > > But some of the attributes of the TextField do not work any more.
> > > >
> > > > Is it possible to add a Font to the LzFontManager during runtime?
> > > > Sothat attributes like resize,multiline do work correctly.
> > > >
> > > > thx & regards
> > > > sebastian
> > > >
> > >
> >
> >
> >
> > --
> > Sebastian Wagner
> > http://www.webbase-design.de
> > http://www.laszlo-forum.de
> > Bleichstraße 92
> > 75173 Pforzheim
> > Tel.: 0177-7341829
> > Home: 07231-417456
> > seba.wagner at gmail.com
> >
> >
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20070129/915db65d/attachment.html


More information about the Laszlo-dev mailing list