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

Max Carlson max at openlaszlo.org
Thu Jan 25 11:06:46 PST 2007


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
> 


More information about the Laszlo-dev mailing list