[Laszlo-checkins] r11838 - in openlaszlo/trunk: WEB-INF/lps/server/src/org/openlaszlo/compiler WEB-INF/lps/server/src/org/openlaszlo/sc test/snippets test/text
hqm@openlaszlo.org
hqm at openlaszlo.org
Thu Nov 20 04:44:07 PST 2008
Author: hqm
Date: 2008-11-20 04:44:01 -0800 (Thu, 20 Nov 2008)
New Revision: 11838
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
openlaszlo/trunk/test/snippets/import-font.lzx
openlaszlo/trunk/test/text/fonts.lzx
Log:
Change 20081119-hqm-g by hqm at badtzmaru.home on 2008-11-19 23:01:24 EST
in /Users/hqm/openlaszlo/trunk4
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix font loading in swf9 loadable libraries
New Features:
Bugs Fixed: LPP-7372
Technical Reviewer: ptw
QA Reviewer: dda
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ call Font.registerFont to register embedded font class; this seems to be a global
class so calling it in the loadable library ends up registering the font in the main app
+ use a counter to generate unique class name for each embedded font
+ also, figured out how to use the "-includes" compiler option to include some classes
from the LFC into the compiled library app, even declaring the LFC as "external" so it all
doesn't get linked in.
Tests:
test/snippets/fontloader.lzx in swf9
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2008-11-20 10:36:18 UTC (rev 11837)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2008-11-20 12:44:01 UTC (rev 11838)
@@ -746,14 +746,19 @@
")]\n");
- String assetClassname = "__embed_lzfont_" + face;
+ String assetClassname = "__embed_lzfont_" + faceCounter++;
sbuf.append("var "+assetClassname+":Class;\n");
+ sbuf.append("Font.registerFont("+assetClassname+");\n");
+
sbuf.append("}#\n");
addScript(sbuf.toString());
return font;
}
+ // Gensym for embedded font classname
+ static int faceCounter = 1;
+
/**
* @return height of fontinfo in pixels
* @param fontInfo
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2008-11-20 10:36:18 UTC (rev 11837)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2008-11-20 12:44:01 UTC (rev 11838)
@@ -913,6 +913,8 @@
if (options.getBoolean(Compiler.SWF9_LOADABLE_LIB)) {
// Exclude the LFC
cmd.add("-external-library-path+="+getLFCLibrary(debug));
+ cmd.add("-includes");
+ cmd.add("LzLibrary");
}
// Add in WEB-INF/flexlib and APPDIR/flexlib to flex library search paths if they exist
Modified: openlaszlo/trunk/test/snippets/import-font.lzx
===================================================================
--- openlaszlo/trunk/test/snippets/import-font.lzx 2008-11-20 10:36:18 UTC (rev 11837)
+++ openlaszlo/trunk/test/snippets/import-font.lzx 2008-11-20 12:44:01 UTC (rev 11838)
@@ -8,6 +8,5 @@
<import name="lib" href="font-library.lzx" stage="late"
onload="new lz.text(canvas,{text: 'foobar', font: 'myfont'})"/>
- <text fontsize="20" font="myfont">This should issue a compiler warning that the font cannot be used in an import library</text>
</canvas>
Modified: openlaszlo/trunk/test/text/fonts.lzx
===================================================================
--- openlaszlo/trunk/test/text/fonts.lzx 2008-11-20 10:36:18 UTC (rev 11837)
+++ openlaszlo/trunk/test/text/fonts.lzx 2008-11-20 12:44:01 UTC (rev 11838)
@@ -24,9 +24,6 @@
<face src="ariosob.ttf" style="bold" />
</font>
- <font name="Chevara" src="chevarar.ttf">
- <face src="chevaraor.ttf" style="bold" />
- </font>
<font name="Conga" src="congar.ttf">
<face src="congab.ttf" style="bold" />
@@ -54,13 +51,6 @@
</font>
<!-- Fonts from the examples directory -->
- <font src="../resources/ttf/clawless.ttf" name="Clawless" >
- <face src="../resources/ttf/clawless.ttf" style="bold" />
- </font>
- <font src="../resources/ttf/kitchen.ttf" name="Kitchen" >
- <face src="../resources/ttf/kitchen.ttf" style="bold" />
- </font>
-
<!-- Laszlo Pixel Font (8) -->
<font src="lzsans8.ttf" name="Sans Serif 8">
<face src="lzsans8b.ttf" style="bold" />
@@ -78,10 +68,6 @@
multiline="true" height="100"
width="200" >hello there
</edittext>
- <edittext pixellock="true" >Chevara
- <method name="onconstruct" args="parent, args">
- </method>
- </edittext>
<text pixellock="true" ><u>Underline</u></text>
<text pixellock="true" ><a href="http://www.laszlosystems.com">www.laszlosystems.com</a></text>
<text pixellock="true" fontsize="20" ><font color="#ff0000">red</font></text>
@@ -184,27 +170,7 @@
<text><b><i>BoldItalic </i>Bold </b><i>Italic </i><u>Underline <b>Bold Underline</b></u></text>
</view>
- <view width="400" font="Clawless" fontsize="24" > <simplelayout axis="y" spacing="10" />
- <text>Clawless</text>
- <!-- Note this font is missing the @,*,(,),= characters -->
- <text>abcdefghijklmnopqrstuvwxyz1234567890!#$%^-</text>
- <text>ABCDEFGHIJKLMNOPQRSTUVWXYZ&,.?;':"</text>
- <inputtext>inputtext here</inputtext>
- <edittext font="Clawless" multiline="true" height="100" width="100" >hello there</edittext>
- <edittext font="Clawless">Clawless</edittext>
- <text><u>Underline</u></text>
- </view>
- <view width="400" font="Kitchen" fontsize="24" > <simplelayout axis="y" spacing="10" />
- <text>Kitchen</text>
- <!-- Note this font is missing the @,*,(,),= characters -->
- <text>abcdefghijklmnopqrstuvwxyz1234567890!#$%^-</text>
- <text>ABCDEFGHIJKLMNOPQRSTUVWXYZ&,./?;':"\~</text>
- <inputtext>inputtext here</inputtext>
- <edittext font="Kitchen" multiline="true" height="100" width="100" >hello there</edittext>
- <edittext font="Kitchen" >Kitchen</edittext>
- <text><u>Underline</u></text>
- </view>
<!-- These fonts do not have italic and bold italic -->
<view width="400" font="Arioso" fontsize="20" >
@@ -231,20 +197,7 @@
<text><u>Underline</u></text>
</view>
- <view width="400" font="Chevara" fontsize="14" >
- <simplelayout axis="y" spacing="10" />
- <text>Chevara</text>
- <text>abcdefghijklmnopqrstuvwxyz1234567890!@#$%^*()-=+|</text>
- <text>ABCDEFGHIJKLMNOPQRSTUVWXYZ&,./<>?;':"[]{}\~`</text>
- <text><b>Bold</b></text>
- <inputtext>inputtext here</inputtext>
- <edittext multiline="true" height="100" width="100" >hello there</edittext>
- <edittext font="Chevara" >Chevara</edittext>
- <text><u>Underline</u></text>
</view>
- <tester font="Clawless" fname="Clawless" />
-
- </view>
<scrollbar axis="y"/>
</window>
More information about the Laszlo-checkins
mailing list